diff --git a/build.xml b/build.xml index b628f14..d8a7671 100644 --- a/build.xml +++ b/build.xml @@ -5,8 +5,8 @@ - - + + @@ -29,7 +29,31 @@ - + + + + + + + + + + + + + + + + + + + + + + + @@ -59,6 +83,10 @@ + + + + @@ -95,13 +123,11 @@ - - - - - - - + + + + @@ -119,8 +145,8 @@ - - + + diff --git a/pcc_at.cfg b/pcc_at.cfg index e39f1c7..d4f058f 100644 --- a/pcc_at.cfg +++ b/pcc_at.cfg @@ -1,19 +1,19 @@ # NetherOres -public sc.p(Lmp;)V # EntityZombiePigman.becomeAngryAt (func_70835_c) -public se.d # EntitySilverfish.allySummonCooldown (field_70843_d) +public tm.c(Lnm;)V # EntityZombiePigman.becomeAngryAt (func_70835_c) +public tp.bp # EntitySilverfish.allySummonCooldown (field_70843_d) # MFR -public mv.e # EntityList.classToIDMapping (field_75624_e) -public mv.f # EntityList.stringToIDMapping (field_75622_f) -public mp.ab # Entity.rand -public sg.a(I)V # EntitySlime.setSlimeSize (func_70799_a) -public sj.a(I)V # EntityZombie.startConversion (func_82228_a) -public nc.e # EntityXPOrb.xpValue -public-f apa.aX # Block.ice (field_72036_aT) -public-f apa.bu # Block.thinGlass (field_72003_bq) +public ns.e # EntityList.classToIDMapping (field_75624_e) +public ns.f # EntityList.stringToIDMapping (field_75622_f) +public nm.ab # Entity.rand (field_70146_Z) +public tr.a(I)V # EntitySlime.setSlimeSize (func_70799_a) +public tv.a(I)V # EntityZombie.startConversion (func_82228_a) +public nz.e # EntityXPOrb.xpValue (field_70530_e) +public-f aqw.aY # Block.ice (field_72036_aT) +public-f aqw.bv # Block.thinGlass (field_72003_bq) # PC Core -public axr.g # GuiScreen.mc (field_73882_e) -public axr.m # GuiScreen.fontRenderer (field_73886_k) -public ayl.e # GuiContainer.guiLeft (field_74198_m) -public ayl.o # GuiContainer.guiTop (field_74197_n) \ No newline at end of file +public awb.f # GuiScreen.mc (field_73882_e) +public awb.o # GuiScreen.fontRenderer (field_73886_k) +public awv.p # GuiContainer.guiLeft (field_74198_m) +public awv.q # GuiContainer.guiTop (field_74197_n) diff --git a/src/powercrystals/core/textures/button_disabled.png b/src/assets/powercrystals/core/textures/button_disabled.png similarity index 100% rename from src/powercrystals/core/textures/button_disabled.png rename to src/assets/powercrystals/core/textures/button_disabled.png diff --git a/src/powercrystals/core/textures/button_enabled.png b/src/assets/powercrystals/core/textures/button_enabled.png similarity index 100% rename from src/powercrystals/core/textures/button_enabled.png rename to src/assets/powercrystals/core/textures/button_enabled.png diff --git a/src/powercrystals/core/textures/button_hover.png b/src/assets/powercrystals/core/textures/button_hover.png similarity index 100% rename from src/powercrystals/core/textures/button_hover.png rename to src/assets/powercrystals/core/textures/button_hover.png diff --git a/src/powercrystals/core/textures/gui_background.png b/src/assets/powercrystals/core/textures/gui_background.png similarity index 100% rename from src/powercrystals/core/textures/gui_background.png rename to src/assets/powercrystals/core/textures/gui_background.png diff --git a/src/powercrystals/core/CoreCore.java b/src/powercrystals/core/CoreCore.java index 441b533..2756a68 100644 --- a/src/powercrystals/core/CoreCore.java +++ b/src/powercrystals/core/CoreCore.java @@ -27,7 +27,7 @@ public class CoreCore extends DummyModContainer implements IUpdateableMod { - public static final String version = "1.5.1R1.1.8B1"; + public static final String version = "1.6.2R1.2.0B1"; public static final String modId = "PowerCrystalsCore"; public static final String modName = "PowerCrystals Core"; @@ -115,4 +115,22 @@ public String getModVersion() { return version; } + + @Override + public File getSource() { + return CoreLoader.source; + } + + @Override + public Class getCustomResourcePackClass() + { + try + { + return getSource().isDirectory() ? Class.forName("cpw.mods.fml.client.FMLFolderResourcePack", true, getClass().getClassLoader()) : Class.forName("cpw.mods.fml.client.FMLFileResourcePack",true, getClass().getClassLoader()); + } + catch (ClassNotFoundException e) + { + return null; + } + } } diff --git a/src/powercrystals/core/CoreLoader.java b/src/powercrystals/core/CoreLoader.java index 04b2178..6cb995a 100644 --- a/src/powercrystals/core/CoreLoader.java +++ b/src/powercrystals/core/CoreLoader.java @@ -1,14 +1,16 @@ package powercrystals.core; +import java.io.File; import java.util.Map; import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; -@MCVersion(value = "1.5.2") +@MCVersion(value = "1.6.2") public class CoreLoader implements IFMLLoadingPlugin { public static boolean runtimeDeobfEnabled = true; + public static File source = null; @Override public String[] getLibraryRequestClass() @@ -38,5 +40,6 @@ public String getSetupClass() public void injectData(Map data) { runtimeDeobfEnabled = (Boolean)data.get("runtimeDeobfuscationEnabled"); + source = (File)data.get("coremodLocation"); } } diff --git a/src/powercrystals/core/asm/PCCASMTransformer.java b/src/powercrystals/core/asm/PCCASMTransformer.java index 09f29b6..749456d 100644 --- a/src/powercrystals/core/asm/PCCASMTransformer.java +++ b/src/powercrystals/core/asm/PCCASMTransformer.java @@ -1,7 +1,7 @@ package powercrystals.core.asm; -import cpw.mods.fml.relauncher.FMLRelauncher; -import cpw.mods.fml.relauncher.IClassTransformer; +import cpw.mods.fml.relauncher.FMLLaunchHandler; +import net.minecraft.launchwrapper.IClassTransformer; import java.util.ArrayList; import java.util.List; @@ -22,7 +22,7 @@ public class PCCASMTransformer implements IClassTransformer { private String desc; private ArrayList workingPath = new ArrayList(); - private boolean isClient = FMLRelauncher.side().equals("CLIENT"); + private boolean isClient = FMLLaunchHandler.side().equals("CLIENT"); public PCCASMTransformer() { @@ -131,7 +131,7 @@ private byte[] writeWorldServer(String name, String transformedName, byte[] byte ClassNode cn = new ClassNode(Opcodes.ASM4); cr.accept(cn, ClassReader.EXPAND_FRAMES); - for(MethodNode m : cn.methods) + for(MethodNode m : (List)cn.methods) { if("".equals(m.name) && "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/world/storage/ISaveHandler;Ljava/lang/String;Lnet/minecraft/world/WorldProvider;Lnet/minecraft/world/WorldSettings;Lnet/minecraft/profiler/Profiler;Lnet/minecraft/logging/ILogAgent;)V".equals(m.desc)) { @@ -186,7 +186,7 @@ private boolean implement(ClassNode cn) return false; } boolean interfaces = false; - for (AnnotationNode node : cn.visibleAnnotations) + for (AnnotationNode node : (List)cn.visibleAnnotations) { if (node.desc.equals(desc)) { diff --git a/src/powercrystals/core/block/BlockFluidClassic.java b/src/powercrystals/core/block/BlockFluidClassic.java index e892e58..f3414b3 100644 --- a/src/powercrystals/core/block/BlockFluidClassic.java +++ b/src/powercrystals/core/block/BlockFluidClassic.java @@ -5,6 +5,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -98,7 +99,7 @@ protected void updateFlowLevel(World world, int x, int y, int z, int quantaRemai } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving living, ItemStack theItem) + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack theItem) { world.setBlock(x, y, z, blockID, quantaPerBlock - 1, 3); } diff --git a/src/powercrystals/core/gui/GuiScreenBase.java b/src/powercrystals/core/gui/GuiScreenBase.java index 9097fd0..8a8ebd7 100644 --- a/src/powercrystals/core/gui/GuiScreenBase.java +++ b/src/powercrystals/core/gui/GuiScreenBase.java @@ -10,14 +10,15 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; +import net.minecraft.util.ResourceLocation; @SideOnly(Side.CLIENT) public abstract class GuiScreenBase extends GuiContainer { protected List _controls = new LinkedList(); - protected String _backgroundTexture; + protected ResourceLocation _backgroundTexture; - public GuiScreenBase(Container container, String backgroundTexture) + public GuiScreenBase(Container container, ResourceLocation backgroundTexture) { super(container); _backgroundTexture = backgroundTexture; @@ -34,7 +35,7 @@ protected void drawGuiContainerBackgroundLayer(float gameTicks, int mouseX, int mouseX -= guiLeft; mouseY -= guiTop; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.renderEngine.bindTexture(_backgroundTexture); + mc.renderEngine.func_110577_a(_backgroundTexture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); GL11.glPushMatrix(); diff --git a/src/powercrystals/core/gui/controls/Button.java b/src/powercrystals/core/gui/controls/Button.java index a0da595..d921ef3 100644 --- a/src/powercrystals/core/gui/controls/Button.java +++ b/src/powercrystals/core/gui/controls/Button.java @@ -3,11 +3,16 @@ import org.lwjgl.opengl.GL11; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.ResourceLocation; import powercrystals.core.gui.Control; import powercrystals.core.gui.GuiRender; public abstract class Button extends Control { + private static final ResourceLocation BUTTON_HOVER = new ResourceLocation("powercrystals", "core/textures/button_hover.png"); + private static final ResourceLocation BUTTON_ENABLED = new ResourceLocation("powercrystals", "core/textures/button_enabled.png"); + private static final ResourceLocation BUTTON_DISABLED = new ResourceLocation("powercrystals", "core/textures/button_disabled.png"); + private String _text; public Button(GuiContainer containerScreen, int x, int y, int width, int height, String text) @@ -26,15 +31,15 @@ public void drawBackground(int mouseX, int mouseY, float gameTicks) { if(enabled && isPointInBounds(mouseX, mouseY)) { - GL11.glBindTexture(GL11.GL_TEXTURE_2D, containerScreen.mc.renderEngine.getTexture("/powercrystals/core/textures/button_hover.png")); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_HOVER); } else if(enabled) { - GL11.glBindTexture(GL11.GL_TEXTURE_2D, containerScreen.mc.renderEngine.getTexture("/powercrystals/core/textures/button_enabled.png")); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_ENABLED); } else { - GL11.glBindTexture(GL11.GL_TEXTURE_2D, containerScreen.mc.renderEngine.getTexture("/powercrystals/core/textures/button_disabled.png")); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_DISABLED); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GuiRender.drawTexturedModalRect(x, y, 0, 0, width / 2, height / 2); diff --git a/src/powercrystals/core/gui/controls/SliderHorizontal.java b/src/powercrystals/core/gui/controls/SliderHorizontal.java index 932e4df..fe09836 100644 --- a/src/powercrystals/core/gui/controls/SliderHorizontal.java +++ b/src/powercrystals/core/gui/controls/SliderHorizontal.java @@ -3,12 +3,17 @@ import org.lwjgl.opengl.GL11; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.ResourceLocation; import powercrystals.core.gui.Control; import powercrystals.core.gui.GuiColor; import powercrystals.core.gui.GuiRender; public abstract class SliderHorizontal extends Control { + private static final ResourceLocation BUTTON_HOVER = new ResourceLocation("powercrystals", "core/textures/button_hover.png"); + private static final ResourceLocation BUTTON_ENABLED = new ResourceLocation("powercrystals", "core/textures/button_enabled.png"); + private static final ResourceLocation BUTTON_DISABLED = new ResourceLocation("powercrystals", "core/textures/button_disabled.png"); + private int _value; private int _valueMax; @@ -49,15 +54,15 @@ public void drawForeground(int mouseX, int mouseY) if(enabled && isPointInBounds(mouseX, mouseY)) { - containerScreen.mc.renderEngine.bindTexture("/powercrystals/core/textures/button_hover.png"); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_HOVER); } else if(enabled) { - containerScreen.mc.renderEngine.bindTexture("/powercrystals/core/textures/button_enabled.png"); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_ENABLED); } else { - containerScreen.mc.renderEngine.bindTexture("/powercrystals/core/textures/button_disabled.png"); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_DISABLED); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GuiRender.drawTexturedModalRect(sliderX, sliderY, 0, 0, sliderWidth / 2, sliderHeight / 2); diff --git a/src/powercrystals/core/gui/controls/SliderVertical.java b/src/powercrystals/core/gui/controls/SliderVertical.java index 905e765..3128042 100644 --- a/src/powercrystals/core/gui/controls/SliderVertical.java +++ b/src/powercrystals/core/gui/controls/SliderVertical.java @@ -1,6 +1,7 @@ package powercrystals.core.gui.controls; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -10,6 +11,10 @@ public abstract class SliderVertical extends Control { + private static final ResourceLocation BUTTON_HOVER = new ResourceLocation("powercrystals", "core/textures/button_hover.png"); + private static final ResourceLocation BUTTON_ENABLED = new ResourceLocation("powercrystals", "core/textures/button_enabled.png"); + private static final ResourceLocation BUTTON_DISABLED = new ResourceLocation("powercrystals", "core/textures/button_disabled.png"); + private int _value; private int _valueMax; @@ -50,15 +55,15 @@ public void drawForeground(int mouseX, int mouseY) if(enabled && isPointInBounds(mouseX, mouseY)) { - containerScreen.mc.renderEngine.bindTexture("/powercrystals/core/textures/button_hover.png"); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_HOVER); } else if(enabled) { - containerScreen.mc.renderEngine.bindTexture("/powercrystals/core/textures/button_enabled.png"); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_ENABLED); } else { - containerScreen.mc.renderEngine.bindTexture("/powercrystals/core/textures/button_disabled.png"); + containerScreen.mc.renderEngine.func_110577_a(BUTTON_DISABLED); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GuiRender.drawTexturedModalRect(sliderX, sliderY, 0, 0, sliderWidth / 2, sliderHeight / 2); diff --git a/src/powercrystals/core/inventory/InventoryManager.java b/src/powercrystals/core/inventory/InventoryManager.java index 801e648..2276e17 100644 --- a/src/powercrystals/core/inventory/InventoryManager.java +++ b/src/powercrystals/core/inventory/InventoryManager.java @@ -13,10 +13,6 @@ public static IInventoryManager create(IInventory inventory, ForgeDirection targ { return new InventoryManagerSided((ISidedInventory)inventory, targetSide); } - else if(inventory instanceof net.minecraftforge.common.ISidedInventory) - { - return new InventoryManagerLegacy((net.minecraftforge.common.ISidedInventory)inventory, targetSide); - } else if(inventory instanceof IInventory) { return new InventoryManagerStandard(inventory, targetSide); diff --git a/src/powercrystals/core/inventory/InventoryManagerLegacy.java b/src/powercrystals/core/inventory/InventoryManagerLegacy.java deleted file mode 100644 index ffe6bfa..0000000 --- a/src/powercrystals/core/inventory/InventoryManagerLegacy.java +++ /dev/null @@ -1,29 +0,0 @@ -package powercrystals.core.inventory; - -import net.minecraftforge.common.ForgeDirection; -import net.minecraftforge.common.ISidedInventory; - -@SuppressWarnings("deprecation") -public class InventoryManagerLegacy extends InventoryManagerStandard -{ - private ISidedInventory _sidedInv; - - public InventoryManagerLegacy(ISidedInventory inventory, ForgeDirection targetSide) - { - super(inventory, targetSide); - _sidedInv = inventory; - } - - @Override - public int[] getSlots() - { - int start = _sidedInv.getStartInventorySide(_targetSide); - int size = _sidedInv.getSizeInventorySide(_targetSide); - int[] sides = new int[size]; - for(int i = start; i < start + size; i++) - { - sides[i - start] = i; - } - return sides; - } -} diff --git a/src/powercrystals/core/inventory/InventoryManagerStandard.java b/src/powercrystals/core/inventory/InventoryManagerStandard.java index 01d2ba6..94f6dc8 100644 --- a/src/powercrystals/core/inventory/InventoryManagerStandard.java +++ b/src/powercrystals/core/inventory/InventoryManagerStandard.java @@ -22,7 +22,7 @@ public InventoryManagerStandard(IInventory inventory, ForgeDirection targetSide) protected boolean canAddItem(ItemStack stack, int slot) { - return _inv.isStackValidForSlot(slot, stack); + return _inv.isItemValidForSlot(slot, stack); } protected boolean canRemoveItem(ItemStack stack, int slot) diff --git a/src/powercrystals/core/power/PowerProviderAdvanced.java b/src/powercrystals/core/power/PowerProviderAdvanced.java deleted file mode 100644 index 2a09859..0000000 --- a/src/powercrystals/core/power/PowerProviderAdvanced.java +++ /dev/null @@ -1,38 +0,0 @@ -package powercrystals.core.power; - -import net.minecraftforge.common.ForgeDirection; -import buildcraft.api.power.IPowerReceptor; -import buildcraft.api.power.PowerProvider; - -public class PowerProviderAdvanced extends PowerProvider -{ - public PowerProviderAdvanced() - { - powerLoss = 0; - powerLossRegularity = 72000; - - configure(0, 0); - } - - public void configure(int maxEnergyReceived, int maxStoredEnergy) - { - super.configure(0, 0, maxEnergyReceived, 0, maxStoredEnergy); - } - - @Override - public boolean update(IPowerReceptor receptor) - { - return false; - } - - @Override - public void receiveEnergy(float quantity, ForgeDirection from) - { - energyStored += quantity; - - if (energyStored > maxEnergyStored) - { - energyStored = maxEnergyStored; - } - } -} \ No newline at end of file diff --git a/src/powercrystals/core/updater/UpdateManager.java b/src/powercrystals/core/updater/UpdateManager.java index 1611eb9..dd4b790 100644 --- a/src/powercrystals/core/updater/UpdateManager.java +++ b/src/powercrystals/core/updater/UpdateManager.java @@ -6,6 +6,7 @@ import powercrystals.core.CoreCore; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatMessageComponent; import cpw.mods.fml.common.IScheduledTickHandler; import cpw.mods.fml.common.TickType; @@ -39,8 +40,8 @@ public void tickStart(EnumSet type, Object... tickData) if(_updateThread.newVersionAvailable()) { EntityPlayer player = (EntityPlayer) tickData[0]; - player.sendChatToPlayer("[" + _mod.getModName() + "] A new version is available: " + _updateThread.newVersion().modVersion().toString()); - player.sendChatToPlayer( _updateThread.newVersion().description()); + player.sendChatToPlayer(ChatMessageComponent.func_111066_d("[" + _mod.getModName() + "] A new version is available: " + _updateThread.newVersion().modVersion().toString())); + player.sendChatToPlayer(ChatMessageComponent.func_111066_d(_updateThread.newVersion().description())); } } } diff --git a/src/powercrystals/core/util/UtilInventory.java b/src/powercrystals/core/util/UtilInventory.java index 4c79f6f..d46e74f 100644 --- a/src/powercrystals/core/util/UtilInventory.java +++ b/src/powercrystals/core/util/UtilInventory.java @@ -5,7 +5,7 @@ import java.util.Map; import java.util.Map.Entry; -import buildcraft.api.transport.IPipeEntry; +import buildcraft.api.transport.IPipeTile; import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; @@ -22,29 +22,35 @@ public abstract class UtilInventory { /** * Searches from position x, y, z, checking for BC-compatible pipes in all directions. - * @return Map specifying all found pipes and their directions. + * @return Map specifying all found pipes and their directions. */ - public static Map findPipes(World world, int x, int y, int z) + public static Map findPipes(World world, int x, int y, int z) { return findPipes(world, x, y, z, ForgeDirection.VALID_DIRECTIONS); } /** * Searches from position x, y, z, checking for BC-compatible pipes in each directiontocheck. - * @return Map specifying all found pipes and their directions. + * @return Map specifying all found pipes and their directions. */ - public static Map findPipes(World world, int x, int y, int z, ForgeDirection[] directionstocheck) + public static Map findPipes(World world, int x, int y, int z, ForgeDirection[] directionstocheck) { - Map pipes = new LinkedHashMap(); + Map pipes = new LinkedHashMap(); for(ForgeDirection direction : directionstocheck) { BlockPosition bp = new BlockPosition(x, y, z); bp.orientation = direction; bp.moveForwards(1); TileEntity te = world.getBlockTileEntity(bp.x, bp.y, bp.z); - if(te instanceof IPipeEntry) + if(te instanceof IPipeTile) { - pipes.put(direction, (IPipeEntry)te); + IPipeTile pipeTile = (IPipeTile)te; + // FIXME: This direction /may/ be reversed from the correct direction. + // Needs MFR update to test. + if(pipeTile.isPipeConnected(direction)) + { + pipes.put(direction, pipeTile); + } } } return pipes; @@ -161,11 +167,13 @@ public static ItemStack dropStack(World world, BlockPosition bp, ItemStack stack } stack = stack.copy(); // (1) Try to put stack in pipes that are in valid directions - for(Entry pipe : findPipes(world, bp.x, bp.y, bp.z, dropdirections).entrySet()) + for(Entry pipe : findPipes(world, bp.x, bp.y, bp.z, dropdirections).entrySet()) { - if(pipe.getValue().acceptItems()) + if(pipe.getValue().getPipeType() == IPipeTile.PipeType.ITEM) { - pipe.getValue().entityEntering(stack.copy(), pipe.getKey()); + // FIXME: This direction /may/ be reversed from the correct direction. + // Needs MFR update to test. + pipe.getValue().injectItem(stack.copy(), true, pipe.getKey()); return null; } }