mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-26 14:24:14 +00:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ab50f50e5 | ||
|
|
23bdc0859d | ||
|
|
f8b1b957a5 | ||
|
|
7268db7037 | ||
|
|
3ef58ef010 | ||
|
|
5320e50578 | ||
|
|
0b1efcbb35 | ||
|
|
e755619edb | ||
|
|
38865f074d | ||
|
|
03d8451e7a | ||
|
|
fb893cfbda | ||
|
|
3fbf782754 | ||
|
|
d3036b8080 | ||
|
|
5acca560f6 | ||
|
|
d3c5f46228 | ||
|
|
62cd116c18 | ||
|
|
51833c1606 | ||
|
|
082a1893a1 | ||
|
|
d27394af29 | ||
|
|
6a9adc80d7 | ||
|
|
2637e9d203 | ||
|
|
c39fa5a19c | ||
|
|
062453df41 |
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.36'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.37'
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -20,6 +20,7 @@ import com.brandon3055.brandonscore.client.utills.GuiHelper;
|
||||
import com.brandon3055.brandonscore.common.utills.Utills;
|
||||
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerReactor;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
|
||||
|
||||
@@ -205,6 +206,10 @@ public class GUIReactor extends GUIBase {
|
||||
100D) + "%");
|
||||
}
|
||||
text.add(core.convertedFuel + " / " + (core.convertedFuel + core.reactorFuel));
|
||||
text.add(
|
||||
"Full: " + (Utills.round(
|
||||
(float) (core.convertedFuel + core.reactorFuel) / ConfigHandler.reactorFuelStorage * 100,
|
||||
1000)) + "%");
|
||||
drawHoveringText(text, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
|
||||
|
||||
+22
-3
@@ -1,15 +1,19 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.multiblock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockCustomDrop;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
|
||||
|
||||
@@ -19,12 +23,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
/**
|
||||
* Created by Brandon on 16/6/2015.
|
||||
*/
|
||||
public class ReactorCore extends BlockDE implements ITileEntityProvider {
|
||||
public class ReactorCore extends BlockCustomDrop implements ITileEntityProvider {
|
||||
|
||||
public ReactorCore() {
|
||||
super(Material.iron);
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
this.setBlockName("reactorCore");
|
||||
this.setHardness(100F);
|
||||
|
||||
ModBlocks.register(this);
|
||||
}
|
||||
@@ -81,4 +85,19 @@ public class ReactorCore extends BlockDE implements ITileEntityProvider {
|
||||
}
|
||||
super.breakBlock(world, x, y, z, blockBroken, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean dropInventory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCustomDropps() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCustomTileEntityDrops(TileEntity te, List<ItemStack> droppes) {
|
||||
|
||||
}
|
||||
}
|
||||
+19
-13
@@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.inventory.GenericInventory;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
|
||||
@@ -20,10 +21,15 @@ import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper;
|
||||
*/
|
||||
public class ContainerReactor extends ContainerDataSync {
|
||||
|
||||
private static final int maximumFuelStorage = 10368;
|
||||
private static final int nuggetFuelAmount = 16;
|
||||
private static final int ingotFuelAmount = nuggetFuelAmount * 9;
|
||||
private static final int blockFuelAmount = ingotFuelAmount * 9;
|
||||
public static final int maximumFuelStorage = ConfigHandler.reactorFuelStorage;
|
||||
public static final int nuggetFuelAmount = ConfigHandler.reactorFuelValue;
|
||||
public static final int ingotFuelAmount = nuggetFuelAmount * 9;
|
||||
public static final int blockFuelAmount = ingotFuelAmount * 9;
|
||||
public static final int tinyChaosAmount = ConfigHandler.reactorChaosValue;
|
||||
public static final int smallChaosAmount = tinyChaosAmount * 9;
|
||||
public static final int largeChaosAmount = smallChaosAmount * 9;
|
||||
public static final int fullChaosAmount = largeChaosAmount * 9;
|
||||
|
||||
private final TileReactorCore core;
|
||||
private final EntityPlayer player;
|
||||
private final GenericInventory ioSlots = new GenericInventory() {
|
||||
@@ -194,20 +200,20 @@ public class ContainerReactor extends ContainerDataSync {
|
||||
int stackSize = core.reactorFuel / nuggetFuelAmount;
|
||||
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.nugget, stackSize, 1));
|
||||
core.reactorFuel -= stackSize * nuggetFuelAmount;
|
||||
} else if (core.convertedFuel / ingotFuelAmount >= 64) {
|
||||
int stackSize = core.convertedFuel / blockFuelAmount;
|
||||
} else if (core.convertedFuel / smallChaosAmount >= 64) {
|
||||
int stackSize = core.convertedFuel / largeChaosAmount;
|
||||
stackSize = Math.min(64, stackSize);
|
||||
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 2));
|
||||
core.convertedFuel -= stackSize * blockFuelAmount;
|
||||
} else if (core.convertedFuel >= ingotFuelAmount) {
|
||||
int stackSize = core.convertedFuel / ingotFuelAmount;
|
||||
core.convertedFuel -= stackSize * largeChaosAmount;
|
||||
} else if (core.convertedFuel >= smallChaosAmount) {
|
||||
int stackSize = core.convertedFuel / smallChaosAmount;
|
||||
stackSize = Math.min(64, stackSize);
|
||||
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 1));
|
||||
core.convertedFuel -= stackSize * ingotFuelAmount;
|
||||
} else if (core.convertedFuel >= nuggetFuelAmount) {
|
||||
int stackSize = core.convertedFuel / nuggetFuelAmount;
|
||||
core.convertedFuel -= stackSize * smallChaosAmount;
|
||||
} else if (core.convertedFuel >= tinyChaosAmount) {
|
||||
int stackSize = core.convertedFuel / tinyChaosAmount;
|
||||
ioSlots.setInventorySlotContents(1, new ItemStack(ModItems.chaosFragment, stackSize, 0));
|
||||
core.convertedFuel -= stackSize * nuggetFuelAmount;
|
||||
core.convertedFuel -= stackSize * tinyChaosAmount;
|
||||
}
|
||||
}
|
||||
return super.slotClick(slot, button, mode, player);
|
||||
|
||||
@@ -73,6 +73,11 @@ public class ConfigHandler {
|
||||
public static boolean enableReactorBigBoom;
|
||||
public static double reactorOutputMultiplier;
|
||||
public static double reactorFuelUsageMultiplier;
|
||||
public static boolean linearReactorFuelUsage;
|
||||
public static int reactorFuelStorage;
|
||||
public static int reactorFuelValue;
|
||||
public static int reactorChaosValue;
|
||||
public static boolean enableAutomation;
|
||||
|
||||
private static String[] defaultSpawnerList = new String[] { "ExampleMob1", "ExampleMob2",
|
||||
"ExampleMob3 (these examples can be deleted)" };
|
||||
@@ -319,13 +324,6 @@ public class ConfigHandler {
|
||||
true,
|
||||
"Setting this to false will reduce the reactor explosion to little more then a tnt blast")
|
||||
.getBoolean(true);
|
||||
reactorFuelUsageMultiplier = config.get(
|
||||
"Draconic Reactor",
|
||||
"FuelUsageMultiplier",
|
||||
1,
|
||||
"Use this to adjust how quickly the reactor uses fuel",
|
||||
0,
|
||||
1000000).getDouble(1);
|
||||
reactorOutputMultiplier = config.get(
|
||||
"Draconic Reactor",
|
||||
"EnergyOutputMultiplier",
|
||||
@@ -333,7 +331,45 @@ public class ConfigHandler {
|
||||
"Use this to adjust the output of the reactor",
|
||||
0,
|
||||
1000000).getDouble(1);
|
||||
|
||||
reactorFuelUsageMultiplier = config.get(
|
||||
"Draconic Reactor",
|
||||
"FuelUsageMultiplier",
|
||||
1,
|
||||
"Use this to adjust how quickly the reactor uses fuel",
|
||||
0,
|
||||
1000000).getDouble(1);
|
||||
linearReactorFuelUsage = config.get(
|
||||
"Draconic Reactor",
|
||||
"linearReactorFuelUsage",
|
||||
linearReactorFuelUsage,
|
||||
"Sets whether the reactor should use linear (true) fuel usage formula or exponential (false)")
|
||||
.getBoolean(true);
|
||||
reactorFuelStorage = config.get(
|
||||
"Draconic Reactor",
|
||||
"maxFuelStorage",
|
||||
10368,
|
||||
"Use this to adjust the maximum fuel storage of the reactor",
|
||||
0,
|
||||
10000000).getInt(10368);
|
||||
reactorFuelValue = config.get(
|
||||
"Draconic Reactor",
|
||||
"awakenedDraconiumFuelValue",
|
||||
16,
|
||||
"Use this to adjust the fuel value of awakened draconium nugget",
|
||||
0,
|
||||
1000000).getInt(16);
|
||||
reactorChaosValue = config.get(
|
||||
"Draconic Reactor",
|
||||
"chaosShardOutputValue",
|
||||
16,
|
||||
"Use this to adjust how much tiny chaos shards you get per fuel value",
|
||||
0,
|
||||
1000000).getInt(16);
|
||||
enableAutomation = config.get(
|
||||
"Draconic Reactor",
|
||||
"enableAutomation",
|
||||
false,
|
||||
"Sets whether the reactor is automatable or not").getBoolean(false);
|
||||
disabledNamesList.clear();
|
||||
for (String s : disabledBlocksItems) {
|
||||
disabledNamesList.add(s);
|
||||
|
||||
+143
-10
@@ -1,12 +1,23 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor;
|
||||
|
||||
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.blockFuelAmount;
|
||||
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.fullChaosAmount;
|
||||
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.ingotFuelAmount;
|
||||
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.maximumFuelStorage;
|
||||
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.nuggetFuelAmount;
|
||||
import static com.brandon3055.draconicevolution.common.handler.ConfigHandler.linearReactorFuelUsage;
|
||||
import static com.brandon3055.draconicevolution.common.handler.ConfigHandler.reactorOutputMultiplier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@@ -24,12 +35,14 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.ReactorSound;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.Particles;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart.ComparatorMode;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileObjectSync;
|
||||
import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
@@ -39,7 +52,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
/**
|
||||
* Created by Brandon on 16/6/2015.
|
||||
*/
|
||||
public class TileReactorCore extends TileObjectSync {
|
||||
public class TileReactorCore extends TileObjectSync implements IInventory {
|
||||
|
||||
public static final int MAXIMUM_PART_DISTANCE = 10;
|
||||
|
||||
@@ -86,6 +99,12 @@ public class TileReactorCore extends TileObjectSync {
|
||||
public int energySaturation = 0;
|
||||
public int maxEnergySaturation = 0;
|
||||
|
||||
public float fuelStorageRatio = (float) ConfigHandler.reactorFuelStorage / 10368; // To keep the temperature
|
||||
// increase unchanged from the
|
||||
// default config if it's changed
|
||||
|
||||
int excessFuel = 0;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ReactorSound reactorSound;
|
||||
|
||||
@@ -110,6 +129,11 @@ public class TileReactorCore extends TileObjectSync {
|
||||
case ONLINE, STOPPING -> runTick();
|
||||
}
|
||||
|
||||
if (excessFuel > 0 || (reactorFuel + convertedFuel) < maximumFuelStorage) {
|
||||
int useExcessFuel = Math.min(maximumFuelStorage - (reactorFuel + convertedFuel), excessFuel);
|
||||
reactorFuel += useExcessFuel;
|
||||
excessFuel -= useExcessFuel;
|
||||
}
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -145,8 +169,8 @@ public class TileReactorCore extends TileObjectSync {
|
||||
private void startingTick() {
|
||||
if (!startupInitialized) {
|
||||
int totalFuel = reactorFuel + convertedFuel;
|
||||
maxFieldCharge = totalFuel * 96.45061728395062 * 100;
|
||||
maxEnergySaturation = (int) (totalFuel * 96.45061728395062 * 1000);
|
||||
maxFieldCharge = (totalFuel / fuelStorageRatio) * 96.45061728395062 * 100;
|
||||
maxEnergySaturation = (int) ((totalFuel / fuelStorageRatio) * 96.45061728395062 * 1000);
|
||||
energySaturation = Math.min(energySaturation, maxEnergySaturation);
|
||||
fieldCharge = Math.min(fieldCharge, maxFieldCharge);
|
||||
startupInitialized = true;
|
||||
@@ -196,7 +220,7 @@ public class TileReactorCore extends TileObjectSync {
|
||||
}
|
||||
|
||||
// Energy Calculation
|
||||
int baseMaxRFt = (int) ((maxEnergySaturation / 1000D) * ConfigHandler.reactorOutputMultiplier * 1.5D);
|
||||
int baseMaxRFt = (int) ((maxEnergySaturation / 1000D) * reactorOutputMultiplier * 1.5D);
|
||||
int maxRFt = (int) (baseMaxRFt * (1D + conversion * 2));
|
||||
generationRate = (1D - saturation) * maxRFt;
|
||||
energySaturation += generationRate;
|
||||
@@ -215,12 +239,17 @@ public class TileReactorCore extends TileObjectSync {
|
||||
fieldCharge -= fieldDrain;
|
||||
|
||||
// Calculate Fuel Usage
|
||||
fuelUseRate = tempDrainFactor * (1D - saturation) * (0.001 * ConfigHandler.reactorFuelUsageMultiplier);
|
||||
if (linearReactorFuelUsage) {
|
||||
fuelUseRate = tempDrainFactor * (1D - saturation) * (0.001 * ConfigHandler.reactorFuelUsageMultiplier);
|
||||
} else {
|
||||
fuelUseRate = tempDrainFactor * (1D - Math.pow(Math.max(saturation - 0.1, 0.1), 0.3))
|
||||
* (0.001 * ConfigHandler.reactorFuelUsageMultiplier);
|
||||
}
|
||||
conversionUnit += fuelUseRate;
|
||||
if (conversionUnit >= 1 && reactorFuel > 0) {
|
||||
conversionUnit--;
|
||||
reactorFuel--;
|
||||
convertedFuel++;
|
||||
reactorFuel -= (int) conversionUnit;
|
||||
convertedFuel += (int) conversionUnit;
|
||||
conversionUnit -= (int) conversionUnit;
|
||||
}
|
||||
|
||||
if (fieldCharge <= 0 && !hasExploded) {
|
||||
@@ -361,7 +390,7 @@ public class TileReactorCore extends TileObjectSync {
|
||||
energySaturation += energyInjected;
|
||||
} else if (reactionTemperature < 2000) {
|
||||
energyInjected = energyToInject;
|
||||
reactionTemperature += (double) energyInjected / (1000D + reactorFuel * 10);
|
||||
reactionTemperature += (double) energyInjected / (1000D + (reactorFuel / fuelStorageRatio) * 10);
|
||||
if (reactionTemperature > 2000) {
|
||||
reactionTemperature = 2000;
|
||||
}
|
||||
@@ -401,7 +430,7 @@ public class TileReactorCore extends TileObjectSync {
|
||||
}
|
||||
|
||||
public double getCoreRadius() {
|
||||
double volume = (double) (reactorFuel + convertedFuel) / 1296D;
|
||||
double volume = (double) (reactorFuel + convertedFuel) / (1296D * fuelStorageRatio);
|
||||
volume *= 1 + (reactionTemperature / maxReactTemperature) * 10D;
|
||||
return Math.cbrt(volume / (4D / 3D * Math.PI));
|
||||
}
|
||||
@@ -586,6 +615,7 @@ public class TileReactorCore extends TileObjectSync {
|
||||
compound.setInteger("maxEnergySaturation", maxEnergySaturation);
|
||||
compound.setInteger("reactorFuel", reactorFuel);
|
||||
compound.setInteger("convertedFuel", convertedFuel);
|
||||
compound.setInteger("excessFuel", excessFuel);
|
||||
compound.setDouble("reactionTemperature", reactionTemperature);
|
||||
compound.setDouble("maxReactTemperature", maxReactTemperature);
|
||||
compound.setDouble("fieldCharge", fieldCharge);
|
||||
@@ -613,6 +643,7 @@ public class TileReactorCore extends TileObjectSync {
|
||||
maxEnergySaturation = compound.getInteger("maxEnergySaturation");
|
||||
reactorFuel = compound.getInteger("reactorFuel");
|
||||
convertedFuel = compound.getInteger("convertedFuel");
|
||||
excessFuel = compound.getInteger("excessFuel");
|
||||
reactionTemperature = compound.getDouble("reactionTemperature");
|
||||
maxReactTemperature = compound.getDouble("maxReactTemperature");
|
||||
fieldCharge = compound.getDouble("fieldCharge");
|
||||
@@ -666,4 +697,106 @@ public class TileReactorCore extends TileObjectSync {
|
||||
}
|
||||
return new Object[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
if (convertedFuel > fullChaosAmount) {
|
||||
return new ItemStack(ModItems.chaosShard, convertedFuel / fullChaosAmount);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int count) {
|
||||
if (convertedFuel > fullChaosAmount) {
|
||||
int chaosShardCount = Math.min((convertedFuel / fullChaosAmount), count);
|
||||
convertedFuel -= chaosShardCount * fullChaosAmount;
|
||||
return new ItemStack(ModItems.chaosShard, chaosShardCount);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||
if (fuelValue(stack) > 0) {
|
||||
int fuelValue = fuelValue(stack) * stack.stackSize;
|
||||
if (fuelValue > maximumFuelStorage - (reactorFuel + convertedFuel)) {
|
||||
fuelValue -= maximumFuelStorage - (reactorFuel + convertedFuel);
|
||||
reactorFuel = maximumFuelStorage - convertedFuel;
|
||||
excessFuel += fuelValue;
|
||||
} else {
|
||||
reactorFuel += fuelValue;
|
||||
}
|
||||
} else if (stack != null) {
|
||||
convertedFuel = stack.stackSize * fullChaosAmount;
|
||||
} else {
|
||||
convertedFuel -= (convertedFuel / fullChaosAmount) * fullChaosAmount;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if (worldObj == null) {
|
||||
return true;
|
||||
}
|
||||
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
|
||||
return false;
|
||||
}
|
||||
return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.4) < 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
System.out.println("open");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
System.out.println("close");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int fuelValue(ItemStack item) {
|
||||
Set<String> oreNames = OreDictionaryHelper.getOreNames(item);
|
||||
|
||||
if (oreNames.contains("blockDraconiumAwakened")) {
|
||||
return blockFuelAmount;
|
||||
}
|
||||
if (oreNames.contains("ingotDraconiumAwakened")) {
|
||||
return ingotFuelAmount;
|
||||
}
|
||||
if (oreNames.contains("nuggetDraconiumAwakened")) {
|
||||
return nuggetFuelAmount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+101
-1
@@ -1,5 +1,13 @@
|
||||
package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor;
|
||||
|
||||
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.fullChaosAmount;
|
||||
import static com.brandon3055.draconicevolution.common.container.ContainerReactor.maximumFuelStorage;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
@@ -11,7 +19,9 @@ import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart;
|
||||
import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore.ReactorState;
|
||||
import com.brandon3055.draconicevolution.common.utills.OreDictionaryHelper;
|
||||
import com.brandon3055.draconicevolution.integration.computers.IDEPeripheral;
|
||||
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
@@ -22,7 +32,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
/**
|
||||
* Created by brandon3055 on 5/7/2015.
|
||||
*/
|
||||
public class TileReactorStabilizer extends TileEntity implements IReactorPart, IEnergyProvider, IDEPeripheral {
|
||||
public class TileReactorStabilizer extends TileEntity
|
||||
implements IReactorPart, IEnergyProvider, IDEPeripheral, ISidedInventory {
|
||||
|
||||
public float coreRotation = 0F;
|
||||
public float ringRotation = 0F;
|
||||
@@ -229,4 +240,93 @@ public class TileReactorStabilizer extends TileEntity implements IReactorPart, I
|
||||
TileReactorCore core = getMaster();
|
||||
return core != null ? core.callMethod(methodName, args) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
int[] i = new int[getSizeInventory()];
|
||||
for (int i1 = 0; i1 < i.length; i1++) i[i1] = i1;
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack item, int side) {
|
||||
TileReactorCore core = getMaster();
|
||||
return (ConfigHandler.enableAutomation && (core.reactorFuel + core.convertedFuel) < maximumFuelStorage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack item, int side) {
|
||||
TileReactorCore core = getMaster();
|
||||
return (ConfigHandler.enableAutomation && core.convertedFuel > fullChaosAmount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIn) {
|
||||
TileReactorCore core = getMaster();
|
||||
return core.getStackInSlot(slotIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int count) {
|
||||
TileReactorCore core = getMaster();
|
||||
return core.decrStackSize(i, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack stack) {
|
||||
TileReactorCore core = getMaster();
|
||||
core.setInventorySlotContents(i, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
TileReactorCore core = getMaster();
|
||||
return core.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
return validInputItems(stack);
|
||||
}
|
||||
|
||||
public boolean validInputItems(ItemStack item) {
|
||||
Set<String> oreNames = OreDictionaryHelper.getOreNames(item);
|
||||
return (oreNames.contains("nuggetDraconiumAwakened") || oreNames.contains("ingotDraconiumAwakened")
|
||||
|| oreNames.contains("blockDraconiumAwakened"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user