mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-10-26 14:24:14 +00:00
Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c56bf6d83 | ||
|
|
18fffbe960 | ||
|
|
426837a212 | ||
|
|
da44c351b8 | ||
|
|
84da2ed44b | ||
|
|
3a6b10b7f3 | ||
|
|
37a3e861e3 | ||
|
|
606d8fa719 | ||
|
|
dd3366bdc3 | ||
|
|
c437a2a440 | ||
|
|
ca32c00962 | ||
|
|
e82e89b7ba | ||
|
|
af28e2bdb8 | ||
|
|
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,5 +1,7 @@
|
||||
package com.brandon3055.draconicevolution.client;
|
||||
|
||||
import static com.brandon3055.draconicevolution.integration.nei.IMCForNEI.IMCSender;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
@@ -173,6 +175,7 @@ public class ClientProxy extends CommonProxy {
|
||||
registerRenderIDs();
|
||||
registerRendering();
|
||||
ResourceHandler.instance.tick(null);
|
||||
IMCSender();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+229
@@ -0,0 +1,229 @@
|
||||
package com.brandon3055.draconicevolution.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.inventory.SlotFakeItem;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.network.DislocatorInhibitorButtonPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.SlotFakeClickPacket;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
|
||||
public class GUIDislocatorInhibitor extends GuiContainer implements INEIGuiHandler {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(
|
||||
References.MODID.toLowerCase(),
|
||||
"textures/gui/Inhibitor.png");
|
||||
private int range = 5;
|
||||
private TileDislocatorInhibitor.ActivityControlType activityControlType = TileDislocatorInhibitor.ActivityControlType.ALWAYS_ACTIVE;
|
||||
private boolean whitelist = false;
|
||||
|
||||
private final ContainerDislocatorInhibitor container;
|
||||
|
||||
public GUIDislocatorInhibitor(InventoryPlayer playerInventory, TileDislocatorInhibitor inhibitor) {
|
||||
super(inhibitor.getGuiContainer(playerInventory));
|
||||
this.container = (ContainerDislocatorInhibitor) inventorySlots;
|
||||
|
||||
xSize = 176;
|
||||
ySize = 142;
|
||||
|
||||
syncWithServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
buttonList.clear();
|
||||
buttonList.add(new GuiButtonAHeight(0, guiLeft + 7, guiTop + 11, 18, 18, "-"));
|
||||
buttonList.add(new GuiButtonAHeight(1, guiLeft + 97, guiTop + 11, 18, 18, "+"));
|
||||
buttonList.add(new GuiButtonAHeight(2, guiLeft + 151, guiTop + 11, 18, 18, ""));
|
||||
buttonList.add(new GuiButtonAHeight(3, guiLeft + 151, guiTop + 33, 18, 18, ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||
drawGuiText();
|
||||
drawGreyOutSlots();
|
||||
drawButtonIcons();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float partialTicks) {
|
||||
super.drawScreen(x, y, partialTicks);
|
||||
ArrayList<String> lines = new ArrayList<>();
|
||||
if ((x - guiLeft > 7 && x - guiLeft < 25) && (y - guiTop > 11 && y - guiTop < 29)) {
|
||||
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.range.increase.txt"));
|
||||
} else if ((x - guiLeft > 97 && x - guiLeft < 115) && (y - guiTop > 11 && y - guiTop < 29)) {
|
||||
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.range.decrease.txt"));
|
||||
} else if ((x - guiLeft > 151 && x - guiLeft < 169) && (y - guiTop > 11 && y - guiTop < 29)) {
|
||||
switch (activityControlType) {
|
||||
case ALWAYS_ACTIVE -> lines
|
||||
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.always.txt"));
|
||||
case WITH_REDSTONE -> lines
|
||||
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.with.txt"));
|
||||
case WITHOUT_REDSTONE -> lines
|
||||
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.without.txt"));
|
||||
case NEVER_ACTIVE -> lines
|
||||
.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.never.txt"));
|
||||
}
|
||||
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.activity.cycle.txt"));
|
||||
} else if ((x - guiLeft > 151 && x - guiLeft < 169) && (y - guiTop > 33 && y - guiTop < 51)) {
|
||||
if (whitelist) {
|
||||
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.whitelist.txt"));
|
||||
} else {
|
||||
lines.add(StatCollector.translateToLocal("gui.de.dislocatorInhibitor.tooltip.blacklist.txt"));
|
||||
}
|
||||
}
|
||||
if (!lines.isEmpty()) {
|
||||
drawHoveringText(lines, x, y, fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
|
||||
if (slotIn instanceof SlotFakeItem sfi) {
|
||||
DraconicEvolution.network.sendToServer(
|
||||
new SlotFakeClickPacket((byte) sfi.getSlotIndex(), this.mc.thePlayer.inventory.getItemStack()));
|
||||
} else {
|
||||
super.handleMouseClick(slotIn, slotId, clickedButton, clickType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
switch (button.id) {
|
||||
case 0 -> { // Range -
|
||||
range = Math.max(range - 1, TileDislocatorInhibitor.MINIMUM_RANGE);
|
||||
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 0, (byte) range));
|
||||
}
|
||||
case 1 -> { // Range +
|
||||
range = Math.min(range + 1, TileDislocatorInhibitor.MAXIMUM_RANGE);
|
||||
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 0, (byte) range));
|
||||
}
|
||||
case 2 -> { // Cycle Activity control
|
||||
activityControlType = activityControlType.getNext();
|
||||
byte controlMode = (byte) (activityControlType.ordinal());
|
||||
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 1, controlMode));
|
||||
}
|
||||
case 3 -> { // Toggle Whitelist/Blacklist mode
|
||||
whitelist = !whitelist;
|
||||
byte whitelistMode = (byte) (whitelist ? 1 : 0);
|
||||
DraconicEvolution.network.sendToServer(new DislocatorInhibitorButtonPacket((byte) 2, whitelistMode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
|
||||
return currentVisibility;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) {
|
||||
if (gui instanceof GUIDislocatorInhibitor) {
|
||||
for (var slot : container.inventorySlots) {
|
||||
if (slot instanceof SlotFakeItem sfi) {
|
||||
if (sfi.isOverSlot(mousex - this.guiLeft, mousey - this.guiTop)) {
|
||||
draggedStack.stackSize = 0;
|
||||
DraconicEvolution.network
|
||||
.sendToServer(new SlotFakeClickPacket((byte) sfi.getSlotIndex(), draggedStack));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void drawGuiText() {
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("gui.de.dislocatorInhibitor.range.txt"),
|
||||
40,
|
||||
17,
|
||||
0x000000,
|
||||
false);
|
||||
fontRendererObj.drawString(String.valueOf(range), range < 10 ? 78 : 75, 17, 0x000000, false);
|
||||
}
|
||||
|
||||
private void drawButtonIcons() {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
|
||||
// activity control button
|
||||
drawTexturedModalRect(151, 11, 0, 142 + (18 * activityControlType.ordinal()), 18, 18);
|
||||
|
||||
// whitelist button
|
||||
drawTexturedModalRect(151, 33, 18, 142 + (whitelist ? 0 : 18), 18, 18);
|
||||
}
|
||||
|
||||
private void drawGreyOutSlots() {
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5f);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
drawTexturedModalRect(7 + i * 18, 33, 36, 142, 18, 18);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
private void syncWithServer() {
|
||||
TileDislocatorInhibitor inhibitor = container.getTileEntity();
|
||||
whitelist = inhibitor.isWhitelist();
|
||||
range = inhibitor.getRange();
|
||||
activityControlType = inhibitor.getActivityControlType();
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.brandon3055.draconicevolution.client.gui.componentguis.GUIManual;
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIReactor;
|
||||
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerEnergyInfuser;
|
||||
@@ -20,6 +21,7 @@ import com.brandon3055.draconicevolution.common.container.ContainerSunDial;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerUpgradeModifier;
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerWeatherController;
|
||||
import com.brandon3055.draconicevolution.common.inventory.InventoryTool;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileEnergyInfuser;
|
||||
@@ -53,6 +55,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
public static final int GUIID_FLOW_GATE = 13;
|
||||
public static final int GUIID_REACTOR = 14;
|
||||
public static final int GUIID_UPGRADE_MODIFIER = 15;
|
||||
public static final int GUIID_DISLOCATOR_INHIBITOR = 16;
|
||||
public static final int GUIID_CONTAINER_TEMPLATE = 100;
|
||||
|
||||
public GuiHandler() {
|
||||
@@ -116,6 +119,11 @@ public class GuiHandler implements IGuiHandler {
|
||||
return new ContainerUpgradeModifier(player.inventory, upgradeModifier);
|
||||
}
|
||||
}
|
||||
case GUIID_DISLOCATOR_INHIBITOR -> {
|
||||
if (tile instanceof TileDislocatorInhibitor inhibitor) {
|
||||
return new ContainerDislocatorInhibitor(player.inventory, inhibitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -199,6 +207,11 @@ public class GuiHandler implements IGuiHandler {
|
||||
new ContainerUpgradeModifier(player.inventory, upgradeModifier));
|
||||
}
|
||||
}
|
||||
case GUIID_DISLOCATOR_INHIBITOR -> {
|
||||
if (tile instanceof TileDislocatorInhibitor inhibitor) {
|
||||
return new GUIDislocatorInhibitor(player.inventory, inhibitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
+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);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.brandon3055.draconicevolution.common.magic.PotionHandler;
|
||||
import com.brandon3055.draconicevolution.common.network.BlockUpdatePacket;
|
||||
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.ContributorPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.DislocatorInhibitorButtonPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.GenericParticlePacket;
|
||||
import com.brandon3055.draconicevolution.common.network.ItemConfigPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.MagnetToggleAckPacket;
|
||||
@@ -48,6 +49,7 @@ import com.brandon3055.draconicevolution.common.network.PlacedItemPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.PlayerDetectorButtonPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.PlayerDetectorStringPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.ShieldHitPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.SlotFakeClickPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.SpeedRequestPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
|
||||
import com.brandon3055.draconicevolution.common.network.TileObjectPacket;
|
||||
@@ -211,6 +213,13 @@ public class CommonProxy {
|
||||
.registerMessage(MagnetTogglePacket.Handler.class, MagnetTogglePacket.class, 19, Side.SERVER);
|
||||
DraconicEvolution.network
|
||||
.registerMessage(MagnetToggleAckPacket.Handler.class, MagnetToggleAckPacket.class, 20, Side.CLIENT);
|
||||
DraconicEvolution.network.registerMessage(
|
||||
DislocatorInhibitorButtonPacket.Handler.class,
|
||||
DislocatorInhibitorButtonPacket.class,
|
||||
21,
|
||||
Side.SERVER);
|
||||
DraconicEvolution.network
|
||||
.registerMessage(SlotFakeClickPacket.Handler.class, SlotFakeClickPacket.class, 22, Side.SERVER);
|
||||
}
|
||||
|
||||
public void registerTileEntities() {
|
||||
|
||||
+52
-8
@@ -1,22 +1,29 @@
|
||||
package com.brandon3055.draconicevolution.common.blocks.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.brandon3055.draconicevolution.DraconicEvolution;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHandler;
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.blocks.BlockDE;
|
||||
import com.brandon3055.draconicevolution.common.lib.References;
|
||||
import com.brandon3055.draconicevolution.common.lib.Strings;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -26,7 +33,7 @@ public class DislocatorInhibitor extends BlockDE implements ITileEntityProvider
|
||||
this.setBlockName(Strings.dislocatorInhibitor);
|
||||
this.setCreativeTab(DraconicEvolution.tabBlocksItems);
|
||||
this.setStepSound(soundTypeStone);
|
||||
ModBlocks.register(this);
|
||||
ModBlocks.register(this, InfusedObsidianItemBlock.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,20 +57,43 @@ public class DislocatorInhibitor extends BlockDE implements ITileEntityProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx,
|
||||
float pry, float prz) {
|
||||
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateRedstoneStatus(World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null) {
|
||||
if (tile instanceof TileDislocatorInhibitor te) {
|
||||
if (!player.isSneaking()) te.increaseRange();
|
||||
else te.decreaseRange();
|
||||
|
||||
if (world.isRemote) player.addChatMessage(new ChatComponentText("Range: " + te.getRange()));
|
||||
if (te.isRedstoneActive() ^ world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
te.setRedstoneActive(world.isBlockIndirectlyGettingPowered(x, y, z));
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor) {
|
||||
updateRedstoneStatus(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float prx,
|
||||
float pry, float prz) {
|
||||
|
||||
if (!world.isRemote) {
|
||||
FMLNetworkHandler
|
||||
.openGui(player, DraconicEvolution.instance, GuiHandler.GUIID_DISLOCATOR_INHIBITOR, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostBlockPlaced(World world, int x, int y, int z, int meta) {
|
||||
updateRedstoneStatus(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, int x, int y, int z, Block blockBroken, int meta) {
|
||||
TileEntity tile = worldIn.getTileEntity(x, y, z);
|
||||
@@ -81,4 +111,18 @@ public class DislocatorInhibitor extends BlockDE implements ITileEntityProvider
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
blockIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + "inhibitor_block");
|
||||
}
|
||||
|
||||
public static class InfusedObsidianItemBlock extends ItemBlock {
|
||||
|
||||
public InfusedObsidianItemBlock(Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
|
||||
list.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("info.de.dislocatorInhibitor.txt"));
|
||||
super.addInformation(p_77624_1_, p_77624_2_, list, p_77624_4_);
|
||||
}
|
||||
}
|
||||
}
|
||||
+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) {
|
||||
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.brandon3055.draconicevolution.common.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.inventory.SlotFakeItem;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
|
||||
public class ContainerDislocatorInhibitor extends Container {
|
||||
|
||||
private TileDislocatorInhibitor inhibitor;
|
||||
|
||||
public ContainerDislocatorInhibitor(InventoryPlayer playerInventory, TileDislocatorInhibitor inhibitor) {
|
||||
this.inhibitor = inhibitor;
|
||||
|
||||
bindPlayerInventory(playerInventory);
|
||||
addContainerSlots(inhibitor);
|
||||
}
|
||||
|
||||
private void bindPlayerInventory(InventoryPlayer invPlayer) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
addSlotToContainer(new Slot(invPlayer, x, 8 + 18 * x, 118));
|
||||
}
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 60 + y * 18));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addContainerSlots(TileDislocatorInhibitor tileInhibitor) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
addSlotToContainer(new SlotFakeItem(tileInhibitor, i, 8 + 18 * i, 34));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return inhibitor.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDragIntoSlot(Slot p_94531_1_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
|
||||
this.inhibitor.addItemFilter(player.inventory.getStackInSlot(slot));
|
||||
return null;
|
||||
}
|
||||
|
||||
public TileDislocatorInhibitor getTileEntity() {
|
||||
return inhibitor;
|
||||
}
|
||||
}
|
||||
+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);
|
||||
|
||||
@@ -77,6 +77,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)" };
|
||||
@@ -350,13 +355,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",
|
||||
@@ -364,7 +362,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 fuel value one tiny chaos shard takes",
|
||||
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);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.brandon3055.draconicevolution.common.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotFakeItem extends Slot {
|
||||
|
||||
public SlotFakeItem(IInventory inventory, int id, int x, int y) {
|
||||
super(inventory, id, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer p_82870_1_, ItemStack p_82870_2_) {
|
||||
super.onPickupFromSlot(p_82870_1_, p_82870_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
// this is here so NEI CheatItemHandler does not eat the handleDragNDrop event
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean isOverSlot(int mouseX, int mouseY) {
|
||||
if (xDisplayPosition < mouseX && mouseX <= xDisplayPosition + 18) {
|
||||
return yDisplayPosition < mouseY && mouseY <= yDisplayPosition + 18;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class Magnet extends ItemDE implements IBauble, IConfigurableItem {
|
||||
|
||||
for (EntityItem item : items) {
|
||||
if (item.getEntityItem() == null || ModHelper.isAE2EntityFloatingItem(item)
|
||||
|| TileDislocatorInhibitor.isInInhibitorRange(world, item.posX, item.posY, item.posZ)) {
|
||||
|| TileDislocatorInhibitor.isBlockedByInhibitor(world, item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class DislocatorInhibitorButtonPacket implements IMessage {
|
||||
|
||||
private short index = 0;
|
||||
private short value = 0;
|
||||
|
||||
public DislocatorInhibitorButtonPacket() {}
|
||||
|
||||
public DislocatorInhibitorButtonPacket(byte index, short value) {
|
||||
this.index = index;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf bytes) {
|
||||
bytes.writeByte(index);
|
||||
bytes.writeByte(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf bytes) {
|
||||
index = bytes.readByte();
|
||||
value = bytes.readByte();
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<DislocatorInhibitorButtonPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(DislocatorInhibitorButtonPacket message, MessageContext ctx) {
|
||||
if (!(ctx
|
||||
.getServerHandler().playerEntity.openContainer instanceof ContainerDislocatorInhibitor container)) {
|
||||
return null;
|
||||
}
|
||||
TileDislocatorInhibitor tile = container.getTileEntity();
|
||||
if (tile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (message.index) {
|
||||
case 0 -> tile.setRange(message.value);
|
||||
case 1 -> tile.setActivityControl(message.value);
|
||||
case 2 -> tile.setWhitelist(message.value);
|
||||
}
|
||||
ctx.getServerHandler().playerEntity.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.brandon3055.draconicevolution.common.network;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDislocatorInhibitor;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.TileDislocatorInhibitor;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class SlotFakeClickPacket implements IMessage {
|
||||
|
||||
private short slotIndex = 0;
|
||||
private ItemStack stack;
|
||||
|
||||
public SlotFakeClickPacket() {}
|
||||
|
||||
public SlotFakeClickPacket(byte slotIndex, ItemStack stack) {
|
||||
this.slotIndex = slotIndex;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf bytes) {
|
||||
bytes.writeByte(slotIndex);
|
||||
ByteBufUtils.writeItemStack(bytes, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf bytes) {
|
||||
slotIndex = bytes.readByte();
|
||||
stack = ByteBufUtils.readItemStack(bytes);
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<SlotFakeClickPacket, IMessage> {
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(SlotFakeClickPacket message, MessageContext ctx) {
|
||||
if (!(ctx
|
||||
.getServerHandler().playerEntity.openContainer instanceof ContainerDislocatorInhibitor container)) {
|
||||
return null;
|
||||
}
|
||||
TileDislocatorInhibitor tile = container.getTileEntity();
|
||||
if (tile == null) {
|
||||
return null;
|
||||
}
|
||||
tile.setFilterItem(message.slotIndex, message.stack);
|
||||
|
||||
ctx.getServerHandler().playerEntity.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+220
-9
@@ -3,6 +3,13 @@ package com.brandon3055.draconicevolution.common.tileentities;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
@@ -10,22 +17,36 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileDislocatorInhibitor extends TileEntity {
|
||||
import com.brandon3055.draconicevolution.common.container.ContainerDislocatorInhibitor;
|
||||
|
||||
public class TileDislocatorInhibitor extends TileEntity implements IInventory {
|
||||
|
||||
public static final int MAXIMUM_RANGE = 16;
|
||||
public static final int MINIMUM_RANGE = 1;
|
||||
public static final int FILTER_SLOTS = 8;
|
||||
public static final HashMap<World, HashSet<TileDislocatorInhibitor>> inhibitors = new HashMap<>();
|
||||
|
||||
private boolean redstoneActive = false;
|
||||
private ActivityControlType activityControlType = ActivityControlType.ALWAYS_ACTIVE;
|
||||
private boolean registered = false;
|
||||
private int range = 5;
|
||||
|
||||
public static boolean isInInhibitorRange(World world, double x, double y, double z) {
|
||||
private boolean whitelist = false;
|
||||
private final ItemStack[] filter = new ItemStack[FILTER_SLOTS];
|
||||
|
||||
public static boolean isBlockedByInhibitor(World world, EntityItem item) {
|
||||
HashSet<TileDislocatorInhibitor> list = inhibitors.get(world);
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
for (TileDislocatorInhibitor inhibitor : list) {
|
||||
if (inhibitor.isInRange(x, y, z)) {
|
||||
if (!inhibitor.shouldBeActive()) {
|
||||
continue;
|
||||
}
|
||||
if (!inhibitor.isBlockingItem(item.getEntityItem())) {
|
||||
continue;
|
||||
}
|
||||
if (inhibitor.isInRange(item.posX, item.posY, item.posZ)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -65,15 +86,37 @@ public class TileDislocatorInhibitor extends TileEntity {
|
||||
this.range = value;
|
||||
}
|
||||
|
||||
public void increaseRange() {
|
||||
if (range < MAXIMUM_RANGE) {
|
||||
range++;
|
||||
public boolean isBlockingItem(ItemStack item) {
|
||||
boolean blocked = false;
|
||||
for (ItemStack itemStack : filter) {
|
||||
if (itemStack == null) {
|
||||
continue;
|
||||
}
|
||||
if (itemStack.getItem() == item.getItem()) {
|
||||
blocked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (whitelist) {
|
||||
return blocked;
|
||||
}
|
||||
return !blocked;
|
||||
}
|
||||
|
||||
public void decreaseRange() {
|
||||
if (range > MINIMUM_RANGE) {
|
||||
range--;
|
||||
public boolean shouldBeActive() {
|
||||
switch (activityControlType) {
|
||||
case NEVER_ACTIVE -> {
|
||||
return false;
|
||||
}
|
||||
case WITH_REDSTONE -> {
|
||||
return redstoneActive;
|
||||
}
|
||||
case WITHOUT_REDSTONE -> {
|
||||
return !redstoneActive;
|
||||
}
|
||||
default -> {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +128,130 @@ public class TileDislocatorInhibitor extends TileEntity {
|
||||
&& z <= this.zCoord + range + 1;
|
||||
}
|
||||
|
||||
public void setActivityControl(int index) {
|
||||
if (index < 0 || index >= ActivityControlType.values().length) {
|
||||
return;
|
||||
}
|
||||
this.activityControlType = ActivityControlType.values()[index];
|
||||
}
|
||||
|
||||
public ActivityControlType getActivityControlType() {
|
||||
return activityControlType;
|
||||
}
|
||||
|
||||
public boolean isRedstoneActive() {
|
||||
return redstoneActive;
|
||||
}
|
||||
|
||||
public void setRedstoneActive(boolean redstoneActive) {
|
||||
this.redstoneActive = redstoneActive;
|
||||
}
|
||||
|
||||
public void setFilterItem(int slot, ItemStack item) {
|
||||
if (slot < 0 || slot >= FILTER_SLOTS) {
|
||||
return;
|
||||
}
|
||||
setInventorySlotContents(slot, item);
|
||||
}
|
||||
|
||||
public void addItemFilter(ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < FILTER_SLOTS; i++) {
|
||||
if (filter[i] == null) {
|
||||
setInventorySlotContents(i, itemStack);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isWhitelist() {
|
||||
return whitelist;
|
||||
}
|
||||
|
||||
public void setWhitelist(short value) {
|
||||
this.whitelist = value == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Dislocator Inhibitor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return FILTER_SLOTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIn) {
|
||||
if (slotIn < 0 || slotIn >= FILTER_SLOTS) {
|
||||
return null;
|
||||
}
|
||||
return this.filter[slotIn];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int count) {
|
||||
ItemStack item = this.filter[index];
|
||||
this.filter[index] = null;
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
item.stackSize = 0;
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, ItemStack stack) {
|
||||
if (stack != null) {
|
||||
this.filter[index] = stack.copy();
|
||||
this.filter[index].stackSize = 0;
|
||||
} else {
|
||||
this.filter[index] = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Container getGuiContainer(InventoryPlayer playerInventory) {
|
||||
return new ContainerDislocatorInhibitor(playerInventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
@@ -101,12 +268,56 @@ public class TileDislocatorInhibitor extends TileEntity {
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
compound.setInteger("Range", range);
|
||||
compound.setBoolean("RedstoneAcitve", redstoneActive);
|
||||
compound.setString("ActivityControl", activityControlType.name());
|
||||
compound.setBoolean("Whitelist", whitelist);
|
||||
|
||||
int i = 0;
|
||||
for (ItemStack item : filter) {
|
||||
NBTTagCompound itemTag = new NBTTagCompound();
|
||||
if (item != null) {
|
||||
item.writeToNBT(itemTag);
|
||||
compound.setTag("Item" + i, itemTag);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
range = compound.getInteger("Range");
|
||||
redstoneActive = compound.getBoolean("RedstoneAcitve");
|
||||
activityControlType = ActivityControlType.valueOf(compound.getString("ActivityControl"));
|
||||
whitelist = compound.getBoolean("Whitelist");
|
||||
|
||||
for (int i = 0; i < FILTER_SLOTS; i++) {
|
||||
NBTBase tag = compound.getTag("Item" + i);
|
||||
if (tag instanceof NBTTagCompound) {
|
||||
filter[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) tag);
|
||||
} else {
|
||||
filter[i] = null;
|
||||
}
|
||||
}
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
public enum ActivityControlType {
|
||||
|
||||
ALWAYS_ACTIVE,
|
||||
WITH_REDSTONE,
|
||||
WITHOUT_REDSTONE,
|
||||
NEVER_ACTIVE;
|
||||
|
||||
public ActivityControlType getNext() {
|
||||
return switch (this) {
|
||||
case ALWAYS_ACTIVE -> ActivityControlType.WITH_REDSTONE;
|
||||
case WITH_REDSTONE -> ActivityControlType.WITHOUT_REDSTONE;
|
||||
case WITHOUT_REDSTONE -> ActivityControlType.NEVER_ACTIVE;
|
||||
default -> ActivityControlType.ALWAYS_ACTIVE;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+144
-11
@@ -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), 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) {
|
||||
@@ -231,7 +260,7 @@ public class TileReactorCore extends TileObjectSync {
|
||||
|
||||
private void goBoom() {
|
||||
if (ConfigHandler.enableReactorBigBoom) {
|
||||
float power = 2F + ((float) (convertedFuel + reactorFuel) / 10369F * 18F);
|
||||
float power = 2F + ((float) (convertedFuel + reactorFuel) / (maximumFuelStorage + 1F) * 18F);
|
||||
ProcessHandler.addProcess(new ReactorExplosion(worldObj, xCoord, yCoord, zCoord, power));
|
||||
sendObjectToClient(
|
||||
References.INT_ID,
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.brandon3055.draconicevolution.integration.nei;
|
||||
|
||||
import static com.brandon3055.draconicevolution.common.lib.References.MODID;
|
||||
import static com.brandon3055.draconicevolution.common.lib.References.MODNAME;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class IMCForNEI {
|
||||
|
||||
public static void IMCSender() {
|
||||
sendHandler(
|
||||
"com.brandon3055.draconicevolution.integration.nei.ReactorNEIHandler",
|
||||
"DraconicEvolution:reactorCore");
|
||||
sendCatalyst("draconicevolution.reactor", "DraconicEvolution:reactorCore");
|
||||
}
|
||||
|
||||
private static void sendHandler(String name, String itemStack) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("handler", name);
|
||||
nbt.setString("modName", MODNAME);
|
||||
nbt.setString("modId", MODID);
|
||||
nbt.setBoolean("modRequired", true);
|
||||
nbt.setString("itemName", itemStack);
|
||||
nbt.setInteger("handlerHeight", 105);
|
||||
nbt.setInteger("maxRecipesPerPage", 1);
|
||||
FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", nbt);
|
||||
}
|
||||
|
||||
private static void sendCatalyst(String name, String itemStack, int priority) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("handlerID", name);
|
||||
nbt.setString("itemName", itemStack);
|
||||
nbt.setInteger("priority", priority);
|
||||
FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", nbt);
|
||||
}
|
||||
|
||||
private static void sendCatalyst(String name, String itemStack) {
|
||||
sendCatalyst(name, itemStack, 0);
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -21,6 +21,8 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI {
|
||||
|
||||
API.registerGuiOverlay(GUIDraconiumChest.class, "crafting", new CraftingChestStackPositioner());
|
||||
API.registerGuiOverlayHandler(GUIDraconiumChest.class, new CraftingChestOverlayHandler(), "crafting");
|
||||
API.registerRecipeHandler(new ReactorNEIHandler());
|
||||
API.registerUsageHandler(new ReactorNEIHandler());
|
||||
API.hideItem(new ItemStack(ModBlocks.placedItem));
|
||||
API.hideItem(new ItemStack(ModBlocks.invisibleMultiblock));
|
||||
API.hideItem(new ItemStack(ModBlocks.safetyFlame));
|
||||
@@ -33,8 +35,8 @@ public class NEIDraconicevolutionConfig implements IConfigureNEI {
|
||||
API.hideItem(new ItemStack(ModBlocks.chaosShardAtmos));
|
||||
API.hideItem(new ItemStack(ModBlocks.chaosCrystal));
|
||||
API.registerNEIGuiHandler(new DENEIGuiHandler());
|
||||
|
||||
LogHelper.info("Added NEI integration");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
package com.brandon3055.draconicevolution.integration.nei;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.brandon3055.draconicevolution.common.ModBlocks;
|
||||
import com.brandon3055.draconicevolution.common.ModItems;
|
||||
import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class ReactorNEIHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return new ResourceLocation("draconicevolution", "textures/gui/nei/reactor.png").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("nei.recipe.reactor.category");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "draconicevolution.reactor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("draconicevolution.reactor") && getClass() == ReactorNEIHandler.class) {
|
||||
final CachedReactorRecipe cachedRecipe = new CachedReactorRecipe();
|
||||
this.arecipes.add(cachedRecipe);
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(final ItemStack result) {
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(ModItems.chaosShard), result)) {
|
||||
final CachedReactorRecipe cachedRecipe = new CachedReactorRecipe();
|
||||
this.arecipes.add(cachedRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(final ItemStack ingredient) {
|
||||
final CachedReactorRecipe cachedRecipe = new CachedReactorRecipe();
|
||||
if ((cachedRecipe.contains(cachedRecipe.ingredients, ingredient.getItem()))) {
|
||||
if (cachedRecipe.contains(cachedRecipe.ingredients, ingredient)) {
|
||||
cachedRecipe.setIngredientPermutation(cachedRecipe.ingredients, ingredient);
|
||||
this.arecipes.add(cachedRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
this.drawProgressBar(16, 18, 176, 10, 24, 28, 1200, 1);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glTranslated(85, 32, 100);
|
||||
int scale = 260;
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileReactorCore(), -0.5D, -0.5D, -0.5D, 0.0F);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(16, 18, 24, 28), "draconicevolution.reactor"));
|
||||
}
|
||||
|
||||
private class CachedReactorRecipe extends CachedRecipe {
|
||||
|
||||
private final List<PositionedStack> ingredients;
|
||||
private final PositionedStack result;
|
||||
|
||||
public CachedReactorRecipe() {
|
||||
this.result = new PositionedStack(new ItemStack(ModItems.chaosShard), 17, 47);
|
||||
this.ingredients = new ArrayList<>();
|
||||
ItemStack[] inputList = { new ItemStack(ModBlocks.draconicBlock), new ItemStack(ModItems.draconicIngot),
|
||||
new ItemStack(ModItems.nugget, 1, 1) };
|
||||
this.ingredients.add(new PositionedStack(inputList, 17, 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(ReactorNEIHandler.this.cycleticks / 20, this.ingredients);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,6 +297,8 @@ info.de.manual.nav1.txt=Navigation Tips
|
||||
info.de.manual.nav2.txt=Press Backspace to go to the previous page.
|
||||
info.de.manual.nav3.txt=Hold shift to scroll faster.
|
||||
|
||||
info.de.dislocatorInhibitor.txt=Magnet blocker
|
||||
|
||||
//Energy Net
|
||||
info.de.modeIn.txt=Mode: Input
|
||||
info.de.modeOut.txt=Mode: Output
|
||||
@@ -309,6 +311,8 @@ info.infusedObsidian.txt=This block is wither resistant
|
||||
|
||||
enchantment.draconicevolution.reaperEnchant=Reaper
|
||||
|
||||
nei.recipe.reactor.category=Reactor
|
||||
|
||||
//Achievements ----------------------------------------------------------------------------------------------------------------------------------------
|
||||
draconicevolution.achievementPage.name=Draconic Evolution
|
||||
|
||||
@@ -659,6 +663,16 @@ gui.de.ShieldRecovery.txt=Shield Recovery
|
||||
gui.de.MoveSpeed.txt=Move Speed
|
||||
gui.de.JumpBoost.txt=Jump Boost
|
||||
|
||||
gui.de.dislocatorInhibitor.range.txt=Range:
|
||||
gui.de.dislocatorInhibitor.tooltip.range.increase.txt=Increase Range
|
||||
gui.de.dislocatorInhibitor.tooltip.range.decrease.txt=Decrease Range
|
||||
gui.de.dislocatorInhibitor.tooltip.activity.always.txt=Active regardles of redstone power
|
||||
gui.de.dislocatorInhibitor.tooltip.activity.with.txt=Active with redstone power
|
||||
gui.de.dislocatorInhibitor.tooltip.activity.without.txt=Active without redstone power
|
||||
gui.de.dislocatorInhibitor.tooltip.activity.never.txt=Always inactive
|
||||
gui.de.dislocatorInhibitor.tooltip.activity.cycle.txt=Click to cycle through activity control
|
||||
gui.de.dislocatorInhibitor.tooltip.whitelist.txt=Only items in filter will be blocked
|
||||
gui.de.dislocatorInhibitor.tooltip.blacklist.txt=Items in filter will NOT be blocked
|
||||
|
||||
//Potions ----------------------------------------------------------------------------------------------------------------------------------------
|
||||
potion.de.effect.txt=Effect
|
||||
@@ -666,4 +680,4 @@ potion.de.flight.txt=Flight
|
||||
potion.de.highStep.txt=High Step
|
||||
potion.de.swiftness.txt=Swiftness
|
||||
potion.de.fireImmune.txt=Fire Immunity
|
||||
potion.de.jumpBoost.txt=Jump Boost
|
||||
potion.de.jumpBoost.txt=Jump Boost
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Reference in new issue
Block a user