This commit is contained in:
Modmuss50 2015-11-23 15:15:42 +00:00
parent abb9b5102f
commit 92ca6548c6
49 changed files with 405 additions and 332 deletions

View file

@ -0,0 +1,61 @@
package ic2.api.tile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* Allows a tile entity to make use of the wrench's removal and rotation functions.
*/
public interface IWrenchable {
/**
* Determine if the wrench can be used to set the block's facing.
* Called before wrenchCanRemove().
*
* @param entityPlayer player using the wrench, may be null
* @param side block's side the wrench was clicked on
* @return Whether the wrenching was done and the wrench should be damaged
*/
boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side);
/**
* Get the block's facing.
*
* @return Block facing
*/
short getFacing();
/**
* Set the block's facing
*
* @param facing facing to set the block to
*/
void setFacing(short facing);
/**
* Determine if the wrench can be used to remove the block.
* Called if wrenchSetFacing fails.
*
* @param entityPlayer player using the wrench, may be null
* @return Whether the wrenching was done and the wrench should be damaged
*/
boolean wrenchCanRemove(EntityPlayer entityPlayer);
/**
* Determine the probability to drop the block as it is.
* The first entry in getDrops will be replaced by blockid:meta if the drop is successful.
*
* @return Probability from 0 to 1
*/
float getWrenchDropRate();
/**
* Determine the item the block will drop when the wrenching is successful.
*
* The ItemStack will be copied before creating the EntityItem.
*
* @param entityPlayer player using the wrench, may be null
* @return ItemStack to drop, may be null
*/
ItemStack getWrenchDrop(EntityPlayer entityPlayer);
}

View file

@ -23,8 +23,6 @@ import techreborn.api.recipe.RecipeHandler;
import techreborn.api.recipe.recipeConfig.RecipeConfigManager; import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
import techreborn.command.TechRebornDevCommand; import techreborn.command.TechRebornDevCommand;
import techreborn.compat.CompatManager;
import techreborn.compat.ICompatModule;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.events.OreUnifier; import techreborn.events.OreUnifier;
import techreborn.events.TRTickHandler; import techreborn.events.TRTickHandler;
@ -63,10 +61,10 @@ public class Core {
.replace(ModInfo.MOD_ID, "TechReborn"); .replace(ModInfo.MOD_ID, "TechReborn");
config = ConfigTechReborn.initialize(new File(path)); config = ConfigTechReborn.initialize(new File(path));
//
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { // for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.preInit(event); // compatModule.preInit(event);
} // }
RecipeConfigManager.load(event.getModConfigurationDirectory()); RecipeConfigManager.load(event.getModConfigurationDirectory());
versionChecker = new VersionChecker("TechReborn", new ModInfo()); versionChecker = new VersionChecker("TechReborn", new ModInfo());
@ -93,9 +91,9 @@ public class Core {
//Client only init, needs to be done before parts system //Client only init, needs to be done before parts system
proxy.init(); proxy.init();
// Compat // Compat
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { // for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.init(event); // compatModule.init(event);
} // }
// WorldGen // WorldGen
GameRegistry.registerWorldGenerator(new TROreGen(), 0); GameRegistry.registerWorldGenerator(new TROreGen(), 0);
// DungeonLoot.init(); // DungeonLoot.init();
@ -118,9 +116,9 @@ public class Core {
@Mod.EventHandler @Mod.EventHandler
public void postinit(FMLPostInitializationEvent event) throws Exception { public void postinit(FMLPostInitializationEvent event) throws Exception {
// Has to be done here as Buildcraft registers their recipes late // Has to be done here as Buildcraft registers their recipes late
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { // for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.postInit(event); // compatModule.postInit(event);
} // }
logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded"); logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
// RecipeHandler.scanForDupeRecipes(); // RecipeHandler.scanForDupeRecipes();
@ -131,9 +129,9 @@ public class Core {
@Mod.EventHandler @Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event) { public void serverStarting(FMLServerStartingEvent event) {
event.registerServerCommand(new TechRebornDevCommand()); event.registerServerCommand(new TechRebornDevCommand());
for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { // for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) {
compatModule.serverStarting(event); // compatModule.serverStarting(event);
} // }
} }
@SubscribeEvent @SubscribeEvent

View file

@ -316,12 +316,12 @@ public class RecipeCrafter {
public void setIsActive() { public void setIsActive() {
if (isActive()) { // if (isActive()) { //TODO 1.8 update
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.getPos().getX(), parentTile.getPos().getY(), parentTile.getPos().getZ(), 1, 2); // parentTile.getWorld().setBlockMetadataWithNotify(parentTile.getPos().getX(), parentTile.getPos().getY(), parentTile.getPos().getZ(), 1, 2);
} else { // } else {
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.getPos().getX(), parentTile.getPos().getY(), parentTile.getPos().getZ(), 0, 2); // parentTile.getWorld().setBlockMetadataWithNotify(parentTile.getPos().getX(), parentTile.getPos().getY(), parentTile.getPos().getZ(), 0, 2);
} // }
parentTile.getWorldObj().markBlockForUpdate(parentTile.getPos().getX(), parentTile.getPos().getY(), parentTile.getPos().getZ()); parentTile.getWorld().markBlockForUpdate(parentTile.getPos());
} }
public void setCurrentRecipe(IBaseRecipeType recipe) { public void setCurrentRecipe(IBaseRecipeType recipe) {

View file

@ -23,7 +23,7 @@ public class UpgradeHandler {
} }
public void tick() { public void tick() {
if (crafter.parentTile.getWorldObj().isRemote) if (crafter.parentTile.getWorld().isRemote)
return; return;
crafter.resetPowerMulti(); crafter.resetPowerMulti();
crafter.resetSpeedMulti(); crafter.resetSpeedMulti();

View file

@ -166,7 +166,7 @@ public class BlockMachineBase extends BlockContainer {
} }
public int getTileRotation(IBlockAccess blockAccess, int x, int y, int z) { public int getTileRotation(IBlockAccess blockAccess, int x, int y, int z) {
return blockAccess.getTileEntity(x, y, z) != null ? getTileRotation(blockAccess.getTileEntity(x, y, z).getWorldObj(), x, y, z) : 0; return blockAccess.getTileEntity(x, y, z) != null ? getTileRotation(blockAccess.getTileEntity(x, y, z).getWorld(), x, y, z) : 0;
} }
@Override @Override
@ -188,7 +188,7 @@ public class BlockMachineBase extends BlockContainer {
@Override @Override
public boolean rotateBlock(World worldObj, int x, int y, int z, EnumFacing axis) { public boolean rotateBlock(World worldObj, int x, int y, int z, EnumFacing axis) {
if (axis == EnumFacing.UNKNOWN) { if (axis == null) {
return false; return false;
} else { } else {
TileEntity tile = worldObj.getTileEntity(x, y, z); TileEntity tile = worldObj.getTileEntity(x, y, z);
@ -222,7 +222,7 @@ public class BlockMachineBase extends BlockContainer {
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current); FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
// Handle filled containers // Handle filled containers
if (liquid != null) { if (liquid != null) {
int qty = tank.fill(EnumFacing.UNKNOWN, liquid, true); int qty = tank.fill(null, liquid, true);
if (qty != 0 && !entityplayer.capabilities.isCreativeMode) { if (qty != 0 && !entityplayer.capabilities.isCreativeMode) {
if (current.stackSize > 1) { if (current.stackSize > 1) {
@ -240,7 +240,7 @@ public class BlockMachineBase extends BlockContainer {
// Handle empty containers // Handle empty containers
} else { } else {
FluidStack available = tank.getTankInfo(EnumFacing.UNKNOWN)[0].fluid; FluidStack available = tank.getTankInfo(null)[0].fluid;
if (available != null) { if (available != null) {
ItemStack filled = FluidContainerRegistry.fillFluidContainer(available, current); ItemStack filled = FluidContainerRegistry.fillFluidContainer(available, current);
@ -261,7 +261,7 @@ public class BlockMachineBase extends BlockContainer {
} }
} }
tank.drain(EnumFacing.UNKNOWN, liquid.amount, true); tank.drain(null, liquid.amount, true);
return true; return true;
} }
@ -275,19 +275,19 @@ public class BlockMachineBase extends BlockContainer {
if (!world.isRemote) { if (!world.isRemote) {
IFluidContainerItem container = (IFluidContainerItem) current.getItem(); IFluidContainerItem container = (IFluidContainerItem) current.getItem();
FluidStack liquid = container.getFluid(current); FluidStack liquid = container.getFluid(current);
FluidStack tankLiquid = tank.getTankInfo(EnumFacing.UNKNOWN)[0].fluid; FluidStack tankLiquid = tank.getTankInfo(null)[0].fluid;
boolean mustDrain = liquid == null || liquid.amount == 0; boolean mustDrain = liquid == null || liquid.amount == 0;
boolean mustFill = tankLiquid == null || tankLiquid.amount == 0; boolean mustFill = tankLiquid == null || tankLiquid.amount == 0;
if (mustDrain && mustFill) { if (mustDrain && mustFill) {
// Both are empty, do nothing // Both are empty, do nothing
} else if (mustDrain || !entityplayer.isSneaking()) { } else if (mustDrain || !entityplayer.isSneaking()) {
liquid = tank.drain(EnumFacing.UNKNOWN, 1000, false); liquid = tank.drain(null, 1000, false);
int qtyToFill = container.fill(current, liquid, true); int qtyToFill = container.fill(current, liquid, true);
tank.drain(EnumFacing.UNKNOWN, qtyToFill, true); tank.drain(null, qtyToFill, true);
} else if (mustFill || entityplayer.isSneaking()) { } else if (mustFill || entityplayer.isSneaking()) {
if (liquid.amount > 0) { if (liquid.amount > 0) {
int qty = tank.fill(EnumFacing.UNKNOWN, liquid, false); int qty = tank.fill(null, liquid, false);
tank.fill(EnumFacing.UNKNOWN, container.drain(current, qty, true), true); tank.fill(null, container.drain(current, qty, true), true);
} }
} }
} }

View file

@ -56,7 +56,7 @@ public class ContainerRollingMachine extends RebornContainer {
@Override @Override
public final void onCraftMatrixChanged(IInventory inv) { public final void onCraftMatrixChanged(IInventory inv) {
ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe( ItemStack output = RollingMachineRecipe.instance.findMatchingRecipe(
tile.craftMatrix, tile.getWorldObj()); tile.craftMatrix, tile.getWorld());
tile.inventory.setInventorySlotContents(1, output); tile.inventory.setInventorySlotContents(1, output);
} }

View file

@ -133,7 +133,7 @@ public class GuiBlastFurnace extends GuiContainer {
MultiblockSet set = new MultiblockSet(multiblock); MultiblockSet set = new MultiblockSet(multiblock);
ClientProxy.multiblockRenderEvent.setMultiblock(set); ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.partent = new Location(blastfurnace.getPos().getX(), blastfurnace.getPos().getY(), blastfurnace.getPos().getZ(), blastfurnace.getWorldObj()); ClientProxy.multiblockRenderEvent.partent = new Location(blastfurnace.getPos().getX(), blastfurnace.getPos().getY(), blastfurnace.getPos().getZ(), blastfurnace.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(blastfurnace.getPos().getX() - (EnumFacing.getOrientation(blastfurnace.getRotation()).offsetX * 2), blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ() - (EnumFacing.getOrientation(blastfurnace.getRotation()).offsetZ * 2)); ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(blastfurnace.getPos().getX() - (EnumFacing.getOrientation(blastfurnace.getRotation()).offsetX * 2), blastfurnace.getPos().getY() - 1, blastfurnace.getPos().getZ() - (EnumFacing.getOrientation(blastfurnace.getRotation()).offsetZ * 2));
} }
button.displayString = "A"; button.displayString = "A";

View file

@ -88,7 +88,7 @@ public class GuiFusionReactor extends GuiContainer {
{//This code here makes a basic multiblock and then sets to the selected one. {//This code here makes a basic multiblock and then sets to the selected one.
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor); MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor);
ClientProxy.multiblockRenderEvent.setMultiblock(set); ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.partent = new Location(fusionController.getPos().getX(), fusionController.getPos().getY(), fusionController.getPos().getZ(), fusionController.getWorldObj()); ClientProxy.multiblockRenderEvent.partent = new Location(fusionController.getPos().getX(), fusionController.getPos().getY(), fusionController.getPos().getZ(), fusionController.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(fusionController.getPos().getX() , fusionController.getPos().getY() -1 , fusionController.getPos().getZ()); ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(fusionController.getPos().getX() , fusionController.getPos().getY() -1 , fusionController.getPos().getZ());
} }
button.displayString = "A"; button.displayString = "A";

View file

@ -86,7 +86,7 @@ public class GuiVacuumFreezer extends GuiContainer {
{//This code here makes a basic multiblock and then sets to the selected one. {//This code here makes a basic multiblock and then sets to the selected one.
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.frezzer); MultiblockSet set = new MultiblockSet(ClientMultiBlocks.frezzer);
ClientProxy.multiblockRenderEvent.setMultiblock(set); ClientProxy.multiblockRenderEvent.setMultiblock(set);
ClientProxy.multiblockRenderEvent.partent = new Location(crafter.getPos().getX(), crafter.getPos().getY(), crafter.getPos().getZ(), crafter.getWorldObj()); ClientProxy.multiblockRenderEvent.partent = new Location(crafter.getPos().getX(), crafter.getPos().getY(), crafter.getPos().getZ(), crafter.getWorld());
ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(crafter.getPos().getX() , crafter.getPos().getY() -5 , crafter.getPos().getZ()); ClientProxy.multiblockRenderEvent.anchor = new ChunkCoordinates(crafter.getPos().getX() , crafter.getPos().getY() -5 , crafter.getPos().getZ());
} }
button.displayString = "A"; button.displayString = "A";

View file

@ -7,8 +7,6 @@ import net.minecraft.util.ChatComponentText;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import reborncore.api.fuel.FluidPowerManager; import reborncore.api.fuel.FluidPowerManager;
import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.RecipeHandler;
import techreborn.partSystem.IModPart;
import techreborn.partSystem.ModPartRegistry;
public class TechRebornDevCommand extends CommandBase { public class TechRebornDevCommand extends CommandBase {
@ -45,10 +43,11 @@ public class TechRebornDevCommand extends CommandBase {
sender.addChatMessage(new ChatComponentText("Found invalid fluid entry")); sender.addChatMessage(new ChatComponentText("Found invalid fluid entry"));
} }
} }
} else if ("parts".equals(args[0])) { // } else if ("parts".equals(args[0])) { //TODO 1.8
for (IModPart part : ModPartRegistry.parts) { // for (IModPart part : ModPartRegistry.parts) {
sender.addChatMessage(new ChatComponentText(part.getName())); // sender.addChatMessage(new ChatComponentText(part.getName()));
} // }
// }
} }
} }
} }

View file

@ -2,9 +2,7 @@ package techreborn.init;
import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Loader;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import techreborn.partSystem.IPartProvider;
import techreborn.partSystem.ModPartRegistry;
import techreborn.partSystem.parts.CablePart;
import java.util.HashMap; import java.util.HashMap;
@ -12,22 +10,22 @@ public class ModParts {
public static HashMap<Integer, ItemStack> stackCable = new HashMap<Integer, ItemStack>(); public static HashMap<Integer, ItemStack> stackCable = new HashMap<Integer, ItemStack>();
public static void init() { public static void init() { //TODO 1.8
if (Loader.isModLoaded("IC2")) { // if (Loader.isModLoaded("IC2")) {
for (int i = 0; i < 11; i++) { // for (int i = 0; i < 11; i++) {
CablePart part = new CablePart(); // CablePart part = new CablePart();
part.setType(i); // part.setType(i);
ModPartRegistry.registerPart(part); // ModPartRegistry.registerPart(part);
} // }
} // }
ModPartRegistry.addProvider("techreborn.partSystem.fmp.FMPFactory", // ModPartRegistry.addProvider("techreborn.partSystem.fmp.FMPFactory",
"ForgeMultipart"); // "ForgeMultipart");
ModPartRegistry.addProvider("techreborn.partSystem.QLib.QModPartFactory", "qmunitylib"); // ModPartRegistry.addProvider("techreborn.partSystem.QLib.QModPartFactory", "qmunitylib");
ModPartRegistry.addAllPartsToSystems(); // ModPartRegistry.addAllPartsToSystems();
for (IPartProvider provider : ModPartRegistry.providers) { // for (IPartProvider provider : ModPartRegistry.providers) {
if (provider.modID().equals("ForgeMultipart")) { // if (provider.modID().equals("ForgeMultipart")) {
ModPartRegistry.masterProvider = provider; // ModPartRegistry.masterProvider = provider;
} // }
} // }
} }
} }

View file

@ -1,5 +1,8 @@
package techreborn.itemblocks; package techreborn.itemblocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -36,25 +39,24 @@ public class ItemBlockAesu extends ItemBlock {
} }
@Override @Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
World world, int x, int y, int z, int side, float hitX, float hitY, if (!world.setBlockState(pos, newState)) {
float hitZ, int metadata) {
if (!world.setBlock(x, y, z, ModBlocks.Aesu, metadata, 3)) {
return false; return false;
} }
if (world.getBlock(x, y, z) == ModBlocks.Aesu) { if (world.getBlockState(pos).getBlock() == block) {
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player,
stack); stack);
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata); // world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x, y, z, metadata);
} }
if (stack != null && stack.hasTagCompound()) { if (stack != null && stack.hasTagCompound()) {
((TileAesu) world.getTileEntity(x, y, z)) ((TileAesu) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound() .readFromNBTWithoutCoords(stack.getTagCompound()
.getCompoundTag("tileEntity")); .getCompoundTag("tileEntity"));
} }
return true; return true;
} }
@SuppressWarnings( @SuppressWarnings(
{"rawtypes", "unchecked"}) {"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -68,7 +70,7 @@ public class ItemBlockAesu extends ItemBlock {
ItemStack dropStack = new ItemStack(ModBlocks.Aesu, 1); ItemStack dropStack = new ItemStack(ModBlocks.Aesu, 1);
writeToNBTWithoutCoords(tileEntity, energy); writeToNBTWithoutCoords(tileEntity, energy);
dropStack.setTagCompound(new NBTTagCompound()); dropStack.setTagCompound(new NBTTagCompound());
dropStack.stackTagCompound.setTag("tileEntity", tileEntity); dropStack.getTagCompound().setTag("tileEntity", tileEntity);
return dropStack; return dropStack;
} }

View file

@ -1,5 +1,8 @@
package techreborn.itemblocks; package techreborn.itemblocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -33,19 +36,17 @@ public class ItemBlockDigitalChest extends ItemBlock {
} }
@Override @Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
World world, int x, int y, int z, int side, float hitX, float hitY, if (!world.setBlockState(pos, newState)) {
float hitZ, int metadata) {
if (!world.setBlock(x, y, z, ModBlocks.digitalChest, metadata, 3)) {
return false; return false;
} }
if (world.getBlock(x, y, z) == ModBlocks.digitalChest) { if (world.getBlockState(pos).getBlock() == block) {
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player,
stack); stack);
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata); // world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x, y, z, metadata);
} }
if (stack != null && stack.hasTagCompound()) { if (stack != null && stack.hasTagCompound()) {
((TileDigitalChest) world.getTileEntity(x, y, z)) ((TileDigitalChest) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound() .readFromNBTWithoutCoords(stack.getTagCompound()
.getCompoundTag("tileEntity")); .getCompoundTag("tileEntity"));
} }

View file

@ -1,5 +1,8 @@
package techreborn.itemblocks; package techreborn.itemblocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -33,19 +36,17 @@ public class ItemBlockQuantumChest extends ItemBlock {
} }
@Override @Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
World world, int x, int y, int z, int side, float hitX, float hitY, if (!world.setBlockState(pos, newState)) {
float hitZ, int metadata) {
if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3)) {
return false; return false;
} }
if (world.getBlock(x, y, z) == ModBlocks.quantumChest) { if (world.getBlockState(pos).getBlock() == block) {
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player,
stack); stack);
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata); // world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x, y, z, metadata);
} }
if (stack != null && stack.hasTagCompound()) { if (stack != null && stack.hasTagCompound()) {
((TileQuantumChest) world.getTileEntity(x, y, z)) ((TileQuantumChest) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound() .readFromNBTWithoutCoords(stack.getTagCompound()
.getCompoundTag("tileEntity")); .getCompoundTag("tileEntity"));
} }

View file

@ -1,9 +1,12 @@
package techreborn.itemblocks; package techreborn.itemblocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.init.ModBlocks; import techreborn.init.ModBlocks;
import techreborn.tiles.TileQuantumTank; import techreborn.tiles.TileQuantumTank;
@ -15,19 +18,17 @@ public class ItemBlockQuantumTank extends ItemBlock {
} }
@Override @Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
World world, int x, int y, int z, int side, float hitX, float hitY, if (!world.setBlockState(pos, newState)) {
float hitZ, int metadata) {
if (!world.setBlock(x, y, z, ModBlocks.quantumTank, metadata, 3)) {
return false; return false;
} }
if (world.getBlock(x, y, z) == ModBlocks.quantumTank) { if (world.getBlockState(pos).getBlock() == block) {
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player, world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player,
stack); stack);
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata); // world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x, y, z, metadata);
} }
if (stack != null && stack.hasTagCompound()) { if (stack != null && stack.hasTagCompound()) {
((TileQuantumTank) world.getTileEntity(x, y, z)) ((TileQuantumTank) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound() .readFromNBTWithoutCoords(stack.getTagCompound()
.getCompoundTag("tileEntity")); .getCompoundTag("tileEntity"));
} }

View file

@ -3,6 +3,7 @@ package techreborn.multiblocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.common.multiblock.CoordTriplet; import reborncore.common.multiblock.CoordTriplet;
import reborncore.common.multiblock.IMultiblockPart; import reborncore.common.multiblock.IMultiblockPart;
@ -110,7 +111,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
for (int z = minimumCoord.z; z <= maximumCoord.z; z++) { for (int z = minimumCoord.z; z <= maximumCoord.z; z++) {
// Okay, figure out what sort of block this should be. // Okay, figure out what sort of block this should be.
te = this.worldObj.getTileEntity(x, y, z); te = this.worldObj.getTileEntity(new BlockPos(x, y, z));
if (te instanceof RectangularMultiblockTileEntityBase) { if (te instanceof RectangularMultiblockTileEntityBase) {
part = (RectangularMultiblockTileEntityBase) te; part = (RectangularMultiblockTileEntityBase) te;
@ -304,7 +305,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
@Override @Override
protected void isBlockGoodForInterior(World world, int x, int y, int z) protected void isBlockGoodForInterior(World world, int x, int y, int z)
throws MultiblockValidationException { throws MultiblockValidationException {
Block block = world.getBlock(x, y, z); Block block = world.getBlockState(new BlockPos(x, y, z)).getBlock();
if (block.getUnlocalizedName().equals("tile.air")) { if (block.getUnlocalizedName().equals("tile.air")) {

View file

@ -35,7 +35,7 @@ public class PacketAesu extends SimplePacket {
@Override @Override
public void execute() { public void execute() {
if (!aesu.getWorldObj().isRemote) { if (!aesu.getWorld().isRemote) {
aesu.handleGuiInputFromClient(buttonID); aesu.handleGuiInputFromClient(buttonID);
} }
} }

View file

@ -35,7 +35,7 @@ public class PacketIdsu extends SimplePacket {
@Override @Override
public void execute() { public void execute() {
if (!idsu.getWorldObj().isRemote) { if (!idsu.getWorld().isRemote) {
idsu.handleGuiInputFromClient(buttonID); idsu.handleGuiInputFromClient(buttonID);
} }
} }

View file

@ -14,6 +14,8 @@ import techreborn.init.ModBlocks;
import techreborn.init.ModItems; import techreborn.init.ModItems;
import techreborn.pda.pages.*; import techreborn.pda.pages.*;
import java.io.IOException;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiManual extends GuiScreen { public class GuiManual extends GuiScreen {
@ -149,8 +151,8 @@ public class GuiManual extends GuiScreen {
} }
@Override @Override
public void mouseMovedOrUp(int par1, int par2, int par3) { protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
root.mouseMovedOrUp(par1, par2, par3); root.mouseMovedOrUp(mouseX, mouseY, clickedMouseButton);
} }
@Override @Override
@ -159,7 +161,7 @@ public class GuiManual extends GuiScreen {
} }
@Override @Override
public void handleInput() { public void handleInput() throws IOException {
super.handleInput(); super.handleInput();
} }

View file

@ -7,6 +7,8 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import techreborn.pda.PageCollection; import techreborn.pda.PageCollection;
import java.io.IOException;
public class BasePage extends GuiScreen { public class BasePage extends GuiScreen {
//Name used to reference the page //Name used to reference the page
@ -90,12 +92,7 @@ public class BasePage extends GuiScreen {
} }
@Override @Override
public void mouseMovedOrUp(int par1, int par2, int par3) { public void mouseClicked(int par1, int par2, int par3) throws IOException {
super.mouseMovedOrUp(par1, par2, par3);
}
@Override
public void mouseClicked(int par1, int par2, int par3) {
super.mouseClicked(par1, par2, par3); super.mouseClicked(par1, par2, par3);
} }

View file

@ -8,6 +8,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*; import net.minecraft.item.crafting.*;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
@ -25,7 +26,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class CraftingInfoPage extends TitledPage { public class CraftingInfoPage extends TitledPage {
protected static RenderItem itemRenderer = new RenderItem(); protected static RenderItem itemRenderer = new RenderItem(Minecraft.getMinecraft().getTextureManager(), new ModelManager(Minecraft.getMinecraft().getTextureMapBlocks()));
public ItemStack result; public ItemStack result;
private boolean isSmelting = false; private boolean isSmelting = false;
private ItemStack[] recipe = new ItemStack[9]; private ItemStack[] recipe = new ItemStack[9];
@ -160,7 +161,7 @@ public class CraftingInfoPage extends TitledPage {
protected void drawItemStackTooltip(ItemStack stack, int x, int y) { protected void drawItemStackTooltip(ItemStack stack, int x, int y) {
final Minecraft mc = Minecraft.getMinecraft(); final Minecraft mc = Minecraft.getMinecraft();
FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRenderer); FontRenderer font = Objects.firstNonNull(stack.getItem().getFontRenderer(stack), mc.fontRendererObj);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips); List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
@ -183,9 +184,9 @@ public class CraftingInfoPage extends TitledPage {
GL11.glEnable(GL11.GL_NORMALIZE); GL11.glEnable(GL11.GL_NORMALIZE);
FontRenderer font = null; FontRenderer font = null;
if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack); if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
if (font == null) font = Minecraft.getMinecraft().fontRenderer; if (font == null) font = Minecraft.getMinecraft().fontRendererObj;
itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3); itemRenderer.renderItemAndEffectIntoGUI(par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str); itemRenderer.renderItemOverlayIntoGUI(font, par1ItemStack, par2, par3, par4Str);
this.zLevel = 0.0F; this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F; itemRenderer.zLevel = 0.0F;
} }
@ -208,7 +209,7 @@ public class CraftingInfoPage extends TitledPage {
} }
Iterator iterator = FurnaceRecipes.smelting().getSmeltingList().entrySet().iterator(); Iterator iterator = FurnaceRecipes.instance().getSmeltingList().entrySet().iterator();
Map.Entry entry; Map.Entry entry;
while (iterator.hasNext()) { while (iterator.hasNext()) {

View file

@ -17,6 +17,6 @@ public class TitledPage extends BasePage {
@Override @Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) { public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
if (title == null) title = INDEX_NAME; if (title == null) title = INDEX_NAME;
if (drawTitle) drawCenteredString(minecraft.fontRenderer, ttl(title), offsetX + 128, offsetY + 5, colour); if (drawTitle) drawCenteredString(minecraft.fontRendererObj, ttl(title), offsetX + 128, offsetY + 5, colour);
} }
} }

View file

@ -35,14 +35,14 @@ public class VersionPage extends TitledPage {
public void addDescription(Minecraft minecraft, int offsetX, int offsetY) { public void addDescription(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix(); GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777); this.drawCenteredString(minecraft.fontRendererObj, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777);
this.drawCenteredString(minecraft.fontRenderer, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777); this.drawCenteredString(minecraft.fontRendererObj, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public void addChangelog(Minecraft minecraft, int offsetX, int offsetY) { public void addChangelog(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix(); GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777); this.drawCenteredString(minecraft.fontRendererObj, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
@ -54,7 +54,7 @@ public class VersionPage extends TitledPage {
int y = offsetY + 105; int y = offsetY + 105;
for (String change : changeLog) { for (String change : changeLog) {
drawCenteredString(minecraft.fontRenderer, change, offsetX + 230, y, Color.white.getRGB()); drawCenteredString(minecraft.fontRendererObj, change, offsetX + 230, y, Color.white.getRGB());
y += 10; y += 10;
} }
GL11.glPopMatrix(); GL11.glPopMatrix();

View file

@ -15,11 +15,11 @@ public class GuiButtonAHeight extends GuiButton {
@Override @Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) { if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer; FontRenderer fontrenderer = minecraft.fontRendererObj;
minecraft.getTextureManager().bindTexture(buttonTextures); minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n); int k = this.getHoverState(this.hovered);
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0); OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
@ -39,7 +39,7 @@ public class GuiButtonAHeight extends GuiButton {
l = packedFGColour; l = packedFGColour;
} else if (!this.enabled) { } else if (!this.enabled) {
l = 10526880; l = 10526880;
} else if (this.field_146123_n) { } else if (this.hovered) {
l = 16777120; l = 16777120;
} }
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l); this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);

View file

@ -46,13 +46,13 @@ public class GuiButtonCustomTexture extends GuiButtonExt {
GL11.glEnable(32826); GL11.glEnable(32826);
RenderHelper.enableStandardItemLighting(); RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, itemstack, this.xPosition, this.yPosition); //RenderItem.getInstance().renderItemIntoGUI(mc.fontRendererObj, mc.renderEngine, itemstack, this.xPosition, this.yPosition); //TODO 1.8
this.drawString(mc.fontRenderer, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB()); this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB());
} }
} }
public boolean getIsHovering() { public boolean getIsHovering() {
return field_146123_n; return hovered;
} }
} }

View file

@ -22,10 +22,10 @@ public class GuiButtonTextOnly extends GuiButton {
@Override @Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) { public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) { if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer; FontRenderer fontrenderer = minecraft.fontRendererObj;
minecraft.getTextureManager().bindTexture(buttonTextures); minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0); OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@ -33,7 +33,7 @@ public class GuiButtonTextOnly extends GuiButton {
this.mouseDragged(minecraft, mouseX, mouseY); this.mouseDragged(minecraft, mouseX, mouseY);
String trimmedDisplayString = displayString; String trimmedDisplayString = displayString;
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.field_146123_n) { if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.hovered) {
int energencyBreak = 0; int energencyBreak = 0;
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) { while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) {
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1); trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1);
@ -43,7 +43,7 @@ public class GuiButtonTextOnly extends GuiButton {
trimmedDisplayString += "..."; trimmedDisplayString += "...";
} }
if (this.field_146123_n) { if (this.hovered) {
trimmedDisplayString = EnumChatFormatting.BOLD + "" + EnumChatFormatting.ITALIC + trimmedDisplayString; trimmedDisplayString = EnumChatFormatting.BOLD + "" + EnumChatFormatting.ITALIC + trimmedDisplayString;
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f); GL11.glColor4f(0f, 0f, 0f, 1f);
@ -58,6 +58,6 @@ public class GuiButtonTextOnly extends GuiButton {
} }
public boolean getIsHovering() { public boolean getIsHovering() {
return field_146123_n; return hovered;
} }
} }

View file

@ -5,6 +5,7 @@ import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver; import cofh.api.energy.IEnergyReceiver;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import techreborn.api.power.IEnergyInterfaceTile; import techreborn.api.power.IEnergyInterfaceTile;
import techreborn.tiles.TileMachineBase; import techreborn.tiles.TileMachineBase;
@ -32,10 +33,10 @@ public abstract class RFProviderTile extends TileMachineBase implements IEnergyR
if (!PowerSystem.RFPOWENET) { if (!PowerSystem.RFPOWENET) {
return; return;
} }
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) { for (EnumFacing direction : EnumFacing.values()) {
int extracted = getEnergyStored(direction); int extracted = getEnergyStored(direction);
TileEntity tile = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); TileEntity tile = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(), getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
if (isPoweredTile(tile, direction)) { if (isPoweredTile(tile, direction)) {
if (canProvideEnergy(direction)) { if (canProvideEnergy(direction)) {
if (tile instanceof IEnergyHandler) { if (tile instanceof IEnergyHandler) {

View file

@ -5,20 +5,12 @@ import cofh.api.energy.IEnergyReceiver;
import com.mojang.realmsclient.gui.ChatFormatting; import com.mojang.realmsclient.gui.ChatFormatting;
import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.Optional;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import ic2.api.energy.tile.IEnergySourceInfo;
import ic2.api.energy.tile.IEnergyTile;
import ic2.api.info.Info;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import techreborn.api.power.IEnergyInterfaceTile; import techreborn.api.power.IEnergyInterfaceTile;
import techreborn.compat.CompatManager;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import java.util.List; import java.util.List;
@ -31,9 +23,9 @@ import java.util.List;
}) })
public abstract class TilePowerAcceptor extends RFProviderTile implements public abstract class TilePowerAcceptor extends RFProviderTile implements
IEnergyReceiver, IEnergyProvider, //Cofh IEnergyReceiver, IEnergyProvider, //Cofh
IEnergyInterfaceTile, IListInfoProvider, //TechReborn IEnergyInterfaceTile, IListInfoProvider //TechReborn
IEnergyTile, IEnergySink, IEnergySource, //Ic2 //IEnergyTile, IEnergySink, IEnergySource, //Ic2
IEnergySourceInfo //IC2 Classic // IEnergySourceInfo //IC2 Classic //TODO ic2
{ {
public int tier; public int tier;
private double energy; private double energy;
@ -49,18 +41,18 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
@Override @Override
public void updateEntity() { public void updateEntity() {
super.updateEntity(); super.updateEntity();
onLoaded(); // onLoaded();
} }
public void onLoaded() { // public void onLoaded() {
if (PowerSystem.EUPOWENET && !addedToEnet && // if (PowerSystem.EUPOWENET && !addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() && // !FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) { // Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); // MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
//
addedToEnet = true; // addedToEnet = true;
} // }
} // }
@Override @Override
public void invalidate() { public void invalidate() {
@ -68,67 +60,67 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
onChunkUnload(); onChunkUnload();
} }
@Override // @Override
public void onChunkUnload() { // public void onChunkUnload() {
super.onChunkUnload(); // super.onChunkUnload();
if (PowerSystem.EUPOWENET) { // if (PowerSystem.EUPOWENET) {
if (addedToEnet && // if (addedToEnet &&
Info.isIc2Available()) { // Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); // MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
//
addedToEnet = false; // addedToEnet = false;
} // }
} // }
} // }
//
@Override // @Override
public double getDemandedEnergy() { // public double getDemandedEnergy() {
if (!PowerSystem.EUPOWENET) // if (!PowerSystem.EUPOWENET)
return 0; // return 0;
return Math.min(getMaxPower() - getEnergy(), getMaxInput()); // return Math.min(getMaxPower() - getEnergy(), getMaxInput());
} // }
//
@Override // @Override
public int getSinkTier() { // public int getSinkTier() {
return tier; // return tier;
} // }
//
@Override // @Override
public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) { // public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) {
setEnergy(getEnergy() + amount); // setEnergy(getEnergy() + amount);
return 0; // return 0;
} // }
//
@Override // @Override
public boolean acceptsEnergyFrom(TileEntity emitter, EnumFacing direction) { // public boolean acceptsEnergyFrom(TileEntity emitter, EnumFacing direction) {
if (!PowerSystem.EUPOWENET) // if (!PowerSystem.EUPOWENET)
return false; // return false;
return canAcceptEnergy(direction); // return canAcceptEnergy(direction);
} // }
//
@Override // @Override
public boolean emitsEnergyTo(TileEntity receiver, EnumFacing direction) { // public boolean emitsEnergyTo(TileEntity receiver, EnumFacing direction) {
if (!PowerSystem.EUPOWENET) // if (!PowerSystem.EUPOWENET)
return false; // return false;
return canProvideEnergy(direction); // return canProvideEnergy(direction);
} // }
//
@Override // @Override
public double getOfferedEnergy() { // public double getOfferedEnergy() {
if (!PowerSystem.EUPOWENET) // if (!PowerSystem.EUPOWENET)
return 0; // return 0;
return Math.min(getEnergy(), getMaxOutput()); // return Math.min(getEnergy(), getMaxOutput());
} // }
//
@Override // @Override
public void drawEnergy(double amount) { // public void drawEnergy(double amount) {
useEnergy((int) amount); // useEnergy((int) amount);
} // }
//
@Override // @Override
public int getSourceTier() { // public int getSourceTier() {
return tier; // return tier;
} // }
//END IC2 //END IC2
//COFH //COFH
@ -147,7 +139,7 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
return 0; return 0;
} }
maxReceive *= ConfigTechReborn.euPerRF; maxReceive *= ConfigTechReborn.euPerRF;
int energyReceived = Math.min(getMaxEnergyStored(EnumFacing.UNKNOWN) - getEnergyStored(EnumFacing.UNKNOWN), Math.min((int) this.getMaxInput() * ConfigTechReborn.euPerRF, maxReceive)); int energyReceived = Math.min(getMaxEnergyStored(null) - getEnergyStored(null), Math.min((int) this.getMaxInput() * ConfigTechReborn.euPerRF, maxReceive));
if (!simulate) { if (!simulate) {
setEnergy(getEnergy() + energyReceived); setEnergy(getEnergy() + energyReceived);
@ -177,7 +169,7 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
return 0; return 0;
} }
maxExtract *= ConfigTechReborn.euPerRF; maxExtract *= ConfigTechReborn.euPerRF;
int energyExtracted = Math.min(getEnergyStored(EnumFacing.UNKNOWN), Math.min(maxExtract, maxExtract)); int energyExtracted = Math.min(getEnergyStored(null), Math.min(maxExtract, maxExtract));
if (!simulate) { if (!simulate) {
setEnergy(energy - energyExtracted); setEnergy(energy - energyExtracted);
@ -300,12 +292,12 @@ public abstract class TilePowerAcceptor extends RFProviderTile implements
} }
//IC2 Classic //IC2 Classic
//
//
@Override // @Override
public int getMaxEnergyAmount() { // public int getMaxEnergyAmount() {
return (int) getMaxOutput(); // return (int) getMaxOutput();
} // }
public int getEnergyScaled(int scale) { public int getEnergyScaled(int scale) {

View file

@ -1,41 +1,39 @@
package techreborn.powerSystem.traits; package techreborn.powerSystem.traits;
import ic2.api.item.IElectricItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import reborncore.jtraits.JTrait; import reborncore.jtraits.JTrait;
import techreborn.api.power.IEnergyInterfaceItem; import techreborn.api.power.IEnergyInterfaceItem;
//TODO ic2
public class EUItemPowerTrait extends JTrait<IEnergyInterfaceItem> {//implements IElectricItem {
public class EUItemPowerTrait extends JTrait<IEnergyInterfaceItem> implements IElectricItem { // @Override
// public boolean canProvideEnergy(ItemStack itemStack) {
@Override // return _self.canAcceptEnergy(itemStack);
public boolean canProvideEnergy(ItemStack itemStack) { // }
return _self.canAcceptEnergy(itemStack); //
} // @Override
// public Item getChargedItem(ItemStack itemStack) {
@Override // return (Item) _self;
public Item getChargedItem(ItemStack itemStack) { // }
return (Item) _self; //
} // @Override
// public Item getEmptyItem(ItemStack itemStack) {
@Override // return (Item) _self;
public Item getEmptyItem(ItemStack itemStack) { // }
return (Item) _self; //
} // @Override
// public double getMaxCharge(ItemStack itemStack) {
@Override // return _self.getMaxPower(itemStack);
public double getMaxCharge(ItemStack itemStack) { // }
return _self.getMaxPower(itemStack); //
} // @Override
// public int getTier(ItemStack itemStack) {
@Override // return _self.getStackTeir(itemStack);
public int getTier(ItemStack itemStack) { // }
return _self.getStackTeir(itemStack); //
} // @Override
// public double getTransferLimit(ItemStack itemStack) {
@Override // return _self.getMaxTransfer(itemStack);
public double getTransferLimit(ItemStack itemStack) { // }
return _self.getMaxTransfer(itemStack);
}
} }

View file

@ -10,6 +10,7 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import reborncore.common.misc.Location; import reborncore.common.misc.Location;
import reborncore.common.multiblock.IMultiblockPart; import reborncore.common.multiblock.IMultiblockPart;
@ -25,7 +26,7 @@ import techreborn.powerSystem.TilePowerAcceptor;
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory { public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory {
public int tickTime; public int tickTime;
public Inventory inventory = new Inventory(4, "TileBlastFurnace", 64); public Inventory inventory = new Inventory(4, "TileBlastFurnace", 64, this);
public RecipeCrafter crafter; public RecipeCrafter crafter;
public int capacity = 1000; public int capacity = 1000;
public static int euTick = 5; public static int euTick = 5;
@ -81,23 +82,23 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
} }
public int getHeat() { public int getHeat() {
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) { for (EnumFacing direction : EnumFacing.values()) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(), getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
if (tileEntity instanceof TileMachineCasing) { if (tileEntity instanceof TileMachineCasing) {
if (((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) { if (((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController(); MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
Location location = new Location(xCoord, yCoord, zCoord, direction); Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
location.modifyPositionFromSide(direction, 1); location.modifyPositionFromSide(direction, 1);
int heat = 0; int heat = 0;
if (worldObj.getBlock(location.getX(), location.getY() - 1, location.getZ()) == tileEntity.getBlockType()) { if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ())).getBlock() == tileEntity.getBlockType()) {
return 0; return 0;
} }
for (IMultiblockPart part : casing.connectedParts) { for (IMultiblockPart part : casing.connectedParts) {
heat += BlockMachineCasing.getHeatFromMeta(part.getWorldObj().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z)); heat += BlockMachineCasing.getHeatFromMeta(part.getWorld().getBlockMetadata(part.getWorldLocation().x, part.getWorldLocation().y, part.getWorldLocation().z));
} }
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava") && worldObj.getBlock(location.getX(), location.getY() + 1, location.getZ()).getUnlocalizedName().equals("tile.lava")) { if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ())).getBlock().getUnlocalizedName().equals("tile.lava") && worldObj.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ())).getBlock().getUnlocalizedName().equals("tile.lava")) {
heat += 500; heat += 500;
} }
return heat; return heat;
@ -132,15 +133,6 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
inventory.setInventorySlotContents(p_70299_1_, p_70299_2_); inventory.setInventorySlotContents(p_70299_1_, p_70299_2_);
} }
@Override
public String getInventoryName() {
return inventory.getInventoryName();
}
@Override
public boolean hasCustomInventoryName() {
return inventory.hasCustomInventoryName();
}
@Override @Override
public int getInventoryStackLimit() { public int getInventoryStackLimit() {
@ -153,13 +145,13 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
} }
@Override @Override
public void openInventory() { public void openInventory(EntityPlayer player) {
inventory.openInventory(); inventory.openInventory(player);
} }
@Override @Override
public void closeInventory() { public void closeInventory(EntityPlayer player) {
inventory.closeInventory(); inventory.closeInventory(player);
} }
@Override @Override
@ -167,19 +159,38 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
return inventory.isItemValidForSlot(p_94041_1_, p_94041_2_); return inventory.isItemValidForSlot(p_94041_1_, p_94041_2_);
} }
@Override
public int getField(int id) {
return inventory.getField(id);
}
@Override
public void setField(int id, int value) {
inventory.setField(id, value);
}
@Override
public int getFieldCount() {
return inventory.getFieldCount();
}
@Override
public void clear() {
inventory.clear();
}
public Packet getDescriptionPacket() { public Packet getDescriptionPacket() {
NBTTagCompound nbtTag = new NBTTagCompound(); NBTTagCompound nbtTag = new NBTTagCompound();
writeToNBT(nbtTag); writeToNBT(nbtTag);
return new S35PacketUpdateTileEntity(this.getPos().getX(), this.getPos().getY(), return new S35PacketUpdateTileEntity(this.getPos(), 1, nbtTag);
this.getPos().getZ(), 1, nbtTag);
} }
@Override @Override
public void onDataPacket(NetworkManager net, public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) { S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.getNbtCompound());
} }
@Override @Override

View file

@ -125,8 +125,8 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
@Override @Override
public void onDataPacket(NetworkManager net, public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) { S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }

View file

@ -102,8 +102,8 @@ public class TileDigitalChest extends TileMachineBase implements IInventory,
@Override @Override
public void onDataPacket(NetworkManager net, public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) { S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }

View file

@ -26,7 +26,7 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
super.updateEntity(); super.updateEntity();
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
if (worldObj.getBlock(xCoord, yCoord + 1, zCoord) == Blocks.dragon_egg) { if (worldObj.getBlock(getPos().getX(), getPos().getY() + 1, getPos().getZ()) == Blocks.dragon_egg) {
addEnergy(euTick); addEnergy(euTick);
} }
} }

View file

@ -139,8 +139,8 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable,
@Override @Override
public void onDataPacket(NetworkManager net, public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) { S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }

View file

@ -81,12 +81,12 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IFlui
public boolean getMutliBlock() { public boolean getMutliBlock() {
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) { for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); TileEntity tileEntity = worldObj.getTileEntity(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ);
if (tileEntity instanceof TileMachineCasing) { if (tileEntity instanceof TileMachineCasing) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) { if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
int heat; int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata()); heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
Location location = new Location(xCoord, yCoord, zCoord, direction); Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
location.modifyPositionFromSide(direction, 1); location.modifyPositionFromSide(direction, 1);
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) { if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500; heat += 500;

View file

@ -22,15 +22,15 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
super.updateEntity(); super.updateEntity();
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
if (worldObj.getBlock(xCoord + 1, yCoord, zCoord) == Blocks.lava) { if (worldObj.getBlock(getPos().getX() + 1, getPos().getY(), getPos().getZ()) == Blocks.lava) {
addEnergy(euTick); addEnergy(euTick);
} else if (worldObj.getBlock(xCoord, yCoord, zCoord + 1) == Blocks.lava) { } else if (worldObj.getBlock(getPos().getX(), getPos().getY(), getPos().getZ() + 1) == Blocks.lava) {
addEnergy(euTick); addEnergy(euTick);
} else if (worldObj.getBlock(xCoord, yCoord, zCoord - 1) == Blocks.lava) { } else if (worldObj.getBlock(getPos().getX(), getPos().getY(), getPos().getZ() - 1) == Blocks.lava) {
addEnergy(euTick); addEnergy(euTick);
} else if (worldObj.getBlock(xCoord - 1, yCoord, zCoord) == Blocks.lava) { } else if (worldObj.getBlock(getPos().getX() - 1, getPos().getY(), getPos().getZ()) == Blocks.lava) {
addEnergy(euTick); addEnergy(euTick);
} else if (worldObj.getBlock(xCoord, yCoord - 1, zCoord) == Blocks.lava) { } else if (worldObj.getBlock(getPos().getX(), getPos().getY() - 1, getPos().getZ()) == Blocks.lava) {
addEnergy(euTick); addEnergy(euTick);
} }

View file

@ -68,12 +68,12 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
public boolean getMutliBlock() { public boolean getMutliBlock() {
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) { for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); TileEntity tileEntity = worldObj.getTileEntity(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ);
if (tileEntity instanceof TileMachineCasing) { if (tileEntity instanceof TileMachineCasing) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) { if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
int heat; int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata()); heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
Location location = new Location(xCoord, yCoord, zCoord, direction); Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
location.modifyPositionFromSide(direction, 1); location.modifyPositionFromSide(direction, 1);
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) { if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500; heat += 500;

View file

@ -54,12 +54,12 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
public boolean getMutliBlock() { public boolean getMutliBlock() {
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) { for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ); TileEntity tileEntity = worldObj.getTileEntity(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ);
if (tileEntity instanceof TileMachineCasing) { if (tileEntity instanceof TileMachineCasing) {
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) { if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
int heat; int heat;
heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata()); heat = BlockMachineCasing.getHeatFromMeta(tileEntity.getBlockMetadata());
Location location = new Location(xCoord, yCoord, zCoord, direction); Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
location.modifyPositionFromSide(direction, 1); location.modifyPositionFromSide(direction, 1);
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) { if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500; heat += 500;

View file

@ -1,5 +1,6 @@
package techreborn.tiles; package techreborn.tiles;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
@ -7,7 +8,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import reborncore.common.packets.PacketHandler; import reborncore.common.packets.PacketHandler;
public class TileMachineBase extends TileEntity { public class TileMachineBase extends TileEntity implements ITickable {
int rotation; int rotation;
@ -21,15 +22,14 @@ public class TileMachineBase extends TileEntity {
public Packet getDescriptionPacket() { public Packet getDescriptionPacket() {
NBTTagCompound nbtTag = new NBTTagCompound(); NBTTagCompound nbtTag = new NBTTagCompound();
writeToNBT(nbtTag); writeToNBT(nbtTag);
return new S35PacketUpdateTileEntity(this.getPos().getX(), this.getPos().getY(), return new S35PacketUpdateTileEntity(this.getPos(), 1, nbtTag);
this.getPos().getZ(), 1, nbtTag);
} }
@Override @Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.getNbtCompound());
} }
public int getRotation() { public int getRotation() {
@ -39,9 +39,9 @@ public class TileMachineBase extends TileEntity {
public void setRotation(int rotation) { public void setRotation(int rotation) {
this.rotation = rotation; this.rotation = rotation;
syncWithAll(); syncWithAll();
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, blockType); worldObj.notifyBlockOfStateChange(getPos(), blockType);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); worldObj.markBlockForUpdate(getPos());
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord); worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(), getPos().getY(), getPos().getZ());
} }
@Override @Override
@ -59,4 +59,13 @@ public class TileMachineBase extends TileEntity {
super.writeToNBT(tagCompound); super.writeToNBT(tagCompound);
tagCompound.setInteger("rotation", rotation); tagCompound.setInteger("rotation", rotation);
} }
@Override
public void tick() {
updateEntity();
}
public void updateEntity() {
}
} }

View file

@ -53,7 +53,7 @@ public class TilePlayerDectector extends TilePowerAcceptor {
while (tIterator.hasNext()) { while (tIterator.hasNext()) {
EntityPlayer player = (EntityPlayer) tIterator.next(); EntityPlayer player = (EntityPlayer) tIterator.next();
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D, (double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) { if (player.getDistanceSq((double) super.getPos().getX() + 0.5D, (double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
if(worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0){//ALL if(worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == 0){//ALL
redstone = true; redstone = true;
} else if (blockMetadata == 1){//Others } else if (blockMetadata == 1){//Others
if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){ if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){
@ -69,8 +69,8 @@ public class TilePlayerDectector extends TilePowerAcceptor {
useEnergy(50); useEnergy(50);
} }
if(lastRedstone != redstone){ if(lastRedstone != redstone){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); worldObj.markBlockForUpdate(getPos().getX(), getPos().getY(), getPos().getZ());
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); worldObj.notifyBlocksOfNeighborChange(getPos().getX(), getPos().getY(), getPos().getZ(), worldObj.getBlock(getPos().getX(), getPos().getY(), getPos().getZ()));
} }
} }
} }

View file

@ -101,7 +101,7 @@ public class TileQuantumChest extends TileMachineBase implements IInventory,
@Override @Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord); worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(), getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }

View file

@ -59,8 +59,8 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler,
@Override @Override
public void onDataPacket(NetworkManager net, public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) { S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }

View file

@ -145,8 +145,8 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
@Override @Override
public void onDataPacket(NetworkManager net, public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) { S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }

View file

@ -128,8 +128,8 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
@Override @Override
public void onDataPacket(NetworkManager net, public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) { S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
yCoord, zCoord); getPos().getY(), getPos().getZ());
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }
@ -139,7 +139,7 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
FluidUtils.drainContainers(this, inventory, 0, 1); FluidUtils.drainContainers(this, inventory, 0, 1);
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) { for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
if (worldObj.getBlock(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ) == Blocks.lava) { if (worldObj.getBlock(getPos().getX() + direction.offsetX, getPos().getY() + direction.offsetY, getPos().getZ() + direction.offsetZ) == Blocks.lava) {
addEnergy(1); addEnergy(1);
} }
} }

View file

@ -190,13 +190,13 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
for (int j = -1; j < 2; j++) { for (int j = -1; j < 2; j++) {
for (int k = -1; k < 2; k++) { for (int k = -1; k < 2; k++) {
if ((i != 0) || (j != 0) || (k != 0)) { if ((i != 0) || (j != 0) || (k != 0)) {
if (worldObj.getBlock(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k) != ModBlocks.MachineCasing) { if (worldObj.getBlock(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k) != ModBlocks.MachineCasing) {
return false; return false;
} }
if (worldObj.getBlockMetadata(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k) != (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1)) { if (worldObj.getBlockMetadata(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k) != (((i == 0) && (j == 0) && (k != 0)) || ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2 : 1)) {
return false; return false;
} }
} else if (!worldObj.isAirBlock(xCoord - xDir + i, yCoord - yDir + j, zCoord - zDir + k)) { } else if (!worldObj.isAirBlock(getPos().getX() - xDir + i, getPos().getY() - yDir + j, getPos().getZ() - zDir + k)) {
return false; return false;
} }
} }

View file

@ -47,12 +47,12 @@ public class TileIDSU extends TilePowerAcceptor {
@Override @Override
public boolean canAcceptEnergy(EnumFacing direction) { public boolean canAcceptEnergy(EnumFacing direction) {
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != Functions.getIntDirFromDirection(direction); return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) != Functions.getIntDirFromDirection(direction);
} }
@Override @Override
public boolean canProvideEnergy(EnumFacing direction) { public boolean canProvideEnergy(EnumFacing direction) {
return worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == Functions.getIntDirFromDirection(direction); return worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == Functions.getIntDirFromDirection(direction);
} }
@Override @Override

View file

@ -22,7 +22,7 @@ public class LesuNetwork {
private void rebuild() { private void rebuild() {
master = null; master = null;
for (TileLesuStorage lesuStorage : storages) { for (TileLesuStorage lesuStorage : storages) {
lesuStorage.findAndJoinNetwork(lesuStorage.getWorldObj(), lesuStorage.getPos().getX(), lesuStorage.getPos().getY(), lesuStorage.getPos().getZ()); lesuStorage.findAndJoinNetwork(lesuStorage.getWorld(), lesuStorage.getPos().getX(), lesuStorage.getPos().getY(), lesuStorage.getPos().getZ());
} }
} }

View file

@ -35,9 +35,9 @@ public class TileLesu extends TilePowerAcceptor {//TODO wrench
countedNetworks.clear(); countedNetworks.clear();
connectedBlocks = 0; connectedBlocks = 0;
for (EnumFacing dir : EnumFacing.VALID_DIRECTIONS) { for (EnumFacing dir : EnumFacing.VALID_DIRECTIONS) {
if (worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ) instanceof TileLesuStorage) { if (worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ) instanceof TileLesuStorage) {
if (((TileLesuStorage) worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)).network != null) { if (((TileLesuStorage) worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ)).network != null) {
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)).network; LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ)).network;
if (!countedNetworks.contains(network)) { if (!countedNetworks.contains(network)) {
if (network.master == null || network.master == this) { if (network.master == null || network.master == this) {
connectedBlocks += network.storages.size(); connectedBlocks += network.storages.size();

View file

@ -12,9 +12,9 @@ public class TileLesuStorage extends TileMachineBase {
public void updateEntity() { public void updateEntity() {
super.updateEntity(); super.updateEntity();
if (network == null) { if (network == null) {
findAndJoinNetwork(worldObj, xCoord, yCoord, zCoord); findAndJoinNetwork(worldObj, getPos().getX(), getPos().getY(), getPos().getZ());
} else { } else {
if (network.master != null && network.master.getWorldObj().getTileEntity(network.master.getPos().getX(), network.master.getPos().getY(), network.master.getPos().getZ()) != network.master) { if (network.master != null && network.master.getWorld().getTileEntity(network.master.getPos().getX(), network.master.getPos().getY(), network.master.getPos().getZ()) != network.master) {
network.master = null; network.master = null;
} }
} }
@ -54,6 +54,6 @@ public class TileLesuStorage extends TileMachineBase {
public final void rebuildNetwork() { public final void rebuildNetwork() {
this.removeFromNetwork(); this.removeFromNetwork();
this.resetNetwork(); this.resetNetwork();
this.findAndJoinNetwork(worldObj, xCoord, yCoord, zCoord); this.findAndJoinNetwork(worldObj, getPos().getX(), getPos().getY(), getPos().getZ());
} }
} }