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

View file

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

View file

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

View file

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

View file

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

View file

@ -133,7 +133,7 @@ public class GuiBlastFurnace extends GuiContainer {
MultiblockSet set = new MultiblockSet(multiblock);
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));
}
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.
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.reactor);
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());
}
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.
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.frezzer);
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());
}
button.displayString = "A";

View file

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

View file

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

View file

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

View file

@ -1,5 +1,8 @@
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.SideOnly;
import net.minecraft.block.Block;
@ -33,19 +36,17 @@ public class ItemBlockDigitalChest extends ItemBlock {
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
World world, int x, int y, int z, int side, float hitX, float hitY,
float hitZ, int metadata) {
if (!world.setBlock(x, y, z, ModBlocks.digitalChest, metadata, 3)) {
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
if (!world.setBlockState(pos, newState)) {
return false;
}
if (world.getBlock(x, y, z) == ModBlocks.digitalChest) {
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player,
if (world.getBlockState(pos).getBlock() == block) {
world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player,
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()) {
((TileDigitalChest) world.getTileEntity(x, y, z))
((TileDigitalChest) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound()
.getCompoundTag("tileEntity"));
}

View file

@ -1,5 +1,8 @@
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.SideOnly;
import net.minecraft.block.Block;
@ -33,19 +36,17 @@ public class ItemBlockQuantumChest extends ItemBlock {
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
World world, int x, int y, int z, int side, float hitX, float hitY,
float hitZ, int metadata) {
if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3)) {
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
if (!world.setBlockState(pos, newState)) {
return false;
}
if (world.getBlock(x, y, z) == ModBlocks.quantumChest) {
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player,
if (world.getBlockState(pos).getBlock() == block) {
world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player,
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()) {
((TileQuantumChest) world.getTileEntity(x, y, z))
((TileQuantumChest) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound()
.getCompoundTag("tileEntity"));
}

View file

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

View file

@ -3,6 +3,7 @@ package techreborn.multiblocks;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import reborncore.common.multiblock.CoordTriplet;
import reborncore.common.multiblock.IMultiblockPart;
@ -110,7 +111,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
for (int z = minimumCoord.z; z <= maximumCoord.z; z++) {
// 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) {
part = (RectangularMultiblockTileEntityBase) te;
@ -304,7 +305,7 @@ public class MultiBlockCasing extends RectangularMultiblockControllerBase {
@Override
protected void isBlockGoodForInterior(World world, int x, int y, int z)
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")) {

View file

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

View file

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

View file

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

View file

@ -7,6 +7,8 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import techreborn.pda.PageCollection;
import java.io.IOException;
public class BasePage extends GuiScreen {
//Name used to reference the page
@ -90,12 +92,7 @@ public class BasePage extends GuiScreen {
}
@Override
public void mouseMovedOrUp(int par1, int par2, int par3) {
super.mouseMovedOrUp(par1, par2, par3);
}
@Override
public void mouseClicked(int par1, int par2, int par3) {
public void mouseClicked(int par1, int par2, int par3) throws IOException {
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.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.model.ModelManager;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.util.EnumChatFormatting;
@ -25,7 +26,7 @@ import java.util.List;
import java.util.Map;
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;
private boolean isSmelting = false;
private ItemStack[] recipe = new ItemStack[9];
@ -160,7 +161,7 @@ public class CraftingInfoPage extends TitledPage {
protected void drawItemStackTooltip(ItemStack stack, int x, int y) {
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")
List<String> list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
@ -183,9 +184,9 @@ public class CraftingInfoPage extends TitledPage {
GL11.glEnable(GL11.GL_NORMALIZE);
FontRenderer font = null;
if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
if (font == null) font = Minecraft.getMinecraft().fontRenderer;
itemRenderer.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().getTextureManager(), par1ItemStack, par2, par3, par4Str);
if (font == null) font = Minecraft.getMinecraft().fontRendererObj;
itemRenderer.renderItemAndEffectIntoGUI(par1ItemStack, par2, par3);
itemRenderer.renderItemOverlayIntoGUI(font, par1ItemStack, par2, par3, par4Str);
this.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;
while (iterator.hasNext()) {

View file

@ -17,6 +17,6 @@ public class TitledPage extends BasePage {
@Override
public void renderOverlayComponents(Minecraft minecraft, int offsetX, int offsetY, int mouseX, int mouseY) {
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) {
GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "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, "INSTALLED VERSION " + ModInfo.MOD_VERSION, offsetX + 120, offsetY + 20, 7777777);
this.drawCenteredString(minecraft.fontRendererObj, "LATEST VERSION " + "TODO", offsetX + 120, offsetY + 40, 7777777);
GL11.glPopMatrix();
}
public void addChangelog(Minecraft minecraft, int offsetX, int offsetY) {
GL11.glPushMatrix();
this.drawCenteredString(minecraft.fontRenderer, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777);
this.drawCenteredString(minecraft.fontRendererObj, "CHANGELOG", offsetX + 120, getYMin() + 50, 7777777);
GL11.glPopMatrix();
}
@ -54,7 +54,7 @@ public class VersionPage extends TitledPage {
int y = offsetY + 105;
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;
}
GL11.glPopMatrix();

View file

@ -15,11 +15,11 @@ public class GuiButtonAHeight extends GuiButton {
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer;
FontRenderer fontrenderer = minecraft.fontRendererObj;
minecraft.getTextureManager().bindTexture(buttonTextures);
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;
int k = this.getHoverState(this.field_146123_n);
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.hovered);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glEnable(GL11.GL_BLEND);
@ -39,7 +39,7 @@ public class GuiButtonAHeight extends GuiButton {
l = packedFGColour;
} else if (!this.enabled) {
l = 10526880;
} else if (this.field_146123_n) {
} else if (this.hovered) {
l = 16777120;
}
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);
RenderHelper.enableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, itemstack, this.xPosition, this.yPosition);
this.drawString(mc.fontRenderer, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB());
//RenderItem.getInstance().renderItemIntoGUI(mc.fontRendererObj, mc.renderEngine, itemstack, this.xPosition, this.yPosition); //TODO 1.8
this.drawString(mc.fontRendererObj, this.NAME, this.xPosition + 20, this.yPosition + 3, Color.white.getRGB());
}
}
public boolean getIsHovering() {
return field_146123_n;
return hovered;
}
}

View file

@ -22,10 +22,10 @@ public class GuiButtonTextOnly extends GuiButton {
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = minecraft.fontRenderer;
FontRenderer fontrenderer = minecraft.fontRendererObj;
minecraft.getTextureManager().bindTexture(buttonTextures);
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);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
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);
String trimmedDisplayString = displayString;
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.field_146123_n) {
if (fontrenderer.getStringWidth(displayString) > width + 30 && !this.hovered) {
int energencyBreak = 0;
while (fontrenderer.getStringWidth(trimmedDisplayString) * 0.7 > width - 5) {
trimmedDisplayString = trimmedDisplayString.substring(0, trimmedDisplayString.length() - 1);
@ -43,7 +43,7 @@ public class GuiButtonTextOnly extends GuiButton {
trimmedDisplayString += "...";
}
if (this.field_146123_n) {
if (this.hovered) {
trimmedDisplayString = EnumChatFormatting.BOLD + "" + EnumChatFormatting.ITALIC + trimmedDisplayString;
GL11.glPushMatrix();
GL11.glColor4f(0f, 0f, 0f, 1f);
@ -58,6 +58,6 @@ public class GuiButtonTextOnly extends GuiButton {
}
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.IEnergyReceiver;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import techreborn.api.power.IEnergyInterfaceTile;
import techreborn.tiles.TileMachineBase;
@ -32,10 +33,10 @@ public abstract class RFProviderTile extends TileMachineBase implements IEnergyR
if (!PowerSystem.RFPOWENET) {
return;
}
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
for (EnumFacing direction : EnumFacing.values()) {
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 (canProvideEnergy(direction)) {
if (tile instanceof IEnergyHandler) {

View file

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

View file

@ -1,41 +1,39 @@
package techreborn.powerSystem.traits;
import ic2.api.item.IElectricItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import reborncore.jtraits.JTrait;
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) {
return _self.canAcceptEnergy(itemStack);
}
@Override
public Item getChargedItem(ItemStack itemStack) {
return (Item) _self;
}
@Override
public Item getEmptyItem(ItemStack itemStack) {
return (Item) _self;
}
@Override
public double getMaxCharge(ItemStack itemStack) {
return _self.getMaxPower(itemStack);
}
@Override
public int getTier(ItemStack itemStack) {
return _self.getStackTeir(itemStack);
}
@Override
public double getTransferLimit(ItemStack itemStack) {
return _self.getMaxTransfer(itemStack);
}
// @Override
// public boolean canProvideEnergy(ItemStack itemStack) {
// return _self.canAcceptEnergy(itemStack);
// }
//
// @Override
// public Item getChargedItem(ItemStack itemStack) {
// return (Item) _self;
// }
//
// @Override
// public Item getEmptyItem(ItemStack itemStack) {
// return (Item) _self;
// }
//
// @Override
// public double getMaxCharge(ItemStack itemStack) {
// return _self.getMaxPower(itemStack);
// }
//
// @Override
// public int getTier(ItemStack itemStack) {
// return _self.getStackTeir(itemStack);
// }
//
// @Override
// 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.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import reborncore.common.misc.Location;
import reborncore.common.multiblock.IMultiblockPart;
@ -25,7 +26,7 @@ import techreborn.powerSystem.TilePowerAcceptor;
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable, IInventory, ISidedInventory {
public int tickTime;
public Inventory inventory = new Inventory(4, "TileBlastFurnace", 64);
public Inventory inventory = new Inventory(4, "TileBlastFurnace", 64, this);
public RecipeCrafter crafter;
public int capacity = 1000;
public static int euTick = 5;
@ -81,23 +82,23 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
}
public int getHeat() {
for (EnumFacing direction : EnumFacing.VALID_DIRECTIONS) {
TileEntity tileEntity = worldObj.getTileEntity(xCoord + direction.offsetX, yCoord + direction.offsetY, zCoord + direction.offsetZ);
for (EnumFacing direction : EnumFacing.values()) {
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(), getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
if (tileEntity instanceof TileMachineCasing) {
if (((TileMachineCasing) tileEntity).isConnected() && ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
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);
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;
}
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;
}
return heat;
@ -132,15 +133,6 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
inventory.setInventorySlotContents(p_70299_1_, p_70299_2_);
}
@Override
public String getInventoryName() {
return inventory.getInventoryName();
}
@Override
public boolean hasCustomInventoryName() {
return inventory.hasCustomInventoryName();
}
@Override
public int getInventoryStackLimit() {
@ -153,13 +145,13 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
}
@Override
public void openInventory() {
inventory.openInventory();
public void openInventory(EntityPlayer player) {
inventory.openInventory(player);
}
@Override
public void closeInventory() {
inventory.closeInventory();
public void closeInventory(EntityPlayer player) {
inventory.closeInventory(player);
}
@Override
@ -167,19 +159,38 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,
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() {
NBTTagCompound nbtTag = new NBTTagCompound();
writeToNBT(nbtTag);
return new S35PacketUpdateTileEntity(this.getPos().getX(), this.getPos().getY(),
this.getPos().getZ(), 1, nbtTag);
return new S35PacketUpdateTileEntity(this.getPos(), 1, nbtTag);
}
@Override
public void onDataPacket(NetworkManager net,
S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
yCoord, zCoord);
readFromNBT(packet.func_148857_g());
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
getPos().getY(), getPos().getZ());
readFromNBT(packet.getNbtCompound());
}
@Override

View file

@ -125,8 +125,8 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
@Override
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());
}

View file

@ -102,8 +102,8 @@ public class TileDigitalChest extends TileMachineBase implements IInventory,
@Override
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());
}

View file

@ -26,7 +26,7 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
super.updateEntity();
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);
}
}

View file

@ -139,8 +139,8 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable,
@Override
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());
}

View file

@ -81,12 +81,12 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable, IFlui
public boolean getMutliBlock() {
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.getBlockType() instanceof BlockMachineCasing)) {
int heat;
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);
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500;

View file

@ -22,15 +22,15 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
super.updateEntity();
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);
} 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);
} 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);
} 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);
} 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);
}

View file

@ -68,12 +68,12 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
public boolean getMutliBlock() {
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.getBlockType() instanceof BlockMachineCasing)) {
int heat;
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);
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500;

View file

@ -54,12 +54,12 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrencha
public boolean getMutliBlock() {
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.getBlockType() instanceof BlockMachineCasing)) {
int heat;
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);
if (worldObj.getBlock(location.getX(), location.getY(), location.getZ()).getUnlocalizedName().equals("tile.lava")) {
heat += 500;

View file

@ -1,5 +1,6 @@
package techreborn.tiles;
import net.minecraft.client.renderer.texture.ITickable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
@ -7,7 +8,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import reborncore.common.packets.PacketHandler;
public class TileMachineBase extends TileEntity {
public class TileMachineBase extends TileEntity implements ITickable {
int rotation;
@ -21,15 +22,14 @@ public class TileMachineBase extends TileEntity {
public Packet getDescriptionPacket() {
NBTTagCompound nbtTag = new NBTTagCompound();
writeToNBT(nbtTag);
return new S35PacketUpdateTileEntity(this.getPos().getX(), this.getPos().getY(),
this.getPos().getZ(), 1, nbtTag);
return new S35PacketUpdateTileEntity(this.getPos(), 1, nbtTag);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord,
yCoord, zCoord);
readFromNBT(packet.func_148857_g());
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
getPos().getY(), getPos().getZ());
readFromNBT(packet.getNbtCompound());
}
public int getRotation() {
@ -39,9 +39,9 @@ public class TileMachineBase extends TileEntity {
public void setRotation(int rotation) {
this.rotation = rotation;
syncWithAll();
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, blockType);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
worldObj.notifyBlockOfStateChange(getPos(), blockType);
worldObj.markBlockForUpdate(getPos());
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(), getPos().getY(), getPos().getZ());
}
@Override
@ -59,4 +59,13 @@ public class TileMachineBase extends TileEntity {
super.writeToNBT(tagCompound);
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()) {
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(worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0){//ALL
if(worldObj.getBlockMetadata(getPos().getX(), getPos().getY(), getPos().getZ()) == 0){//ALL
redstone = true;
} else if (blockMetadata == 1){//Others
if(!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())){
@ -69,8 +69,8 @@ public class TilePlayerDectector extends TilePowerAcceptor {
useEnergy(50);
}
if(lastRedstone != redstone){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
worldObj.markBlockForUpdate(getPos().getX(), getPos().getY(), getPos().getZ());
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
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());
}

View file

@ -59,8 +59,8 @@ public class TileQuantumTank extends TileMachineBase implements IFluidHandler,
@Override
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());
}

View file

@ -145,8 +145,8 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
@Override
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());
}

View file

@ -128,8 +128,8 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
@Override
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());
}
@ -139,7 +139,7 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
if (!worldObj.isRemote) {
FluidUtils.drainContainers(this, inventory, 0, 1);
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);
}
}

View file

@ -190,13 +190,13 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
for (int j = -1; j < 2; j++) {
for (int k = -1; k < 2; k++) {
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;
}
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;
}
} 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;
}
}

View file

@ -47,12 +47,12 @@ public class TileIDSU extends TilePowerAcceptor {
@Override
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
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

View file

@ -22,7 +22,7 @@ public class LesuNetwork {
private void rebuild() {
master = null;
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();
connectedBlocks = 0;
for (EnumFacing dir : EnumFacing.VALID_DIRECTIONS) {
if (worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ) instanceof TileLesuStorage) {
if (((TileLesuStorage) worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)).network != null) {
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)).network;
if (worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ) instanceof TileLesuStorage) {
if (((TileLesuStorage) worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ)).network != null) {
LesuNetwork network = ((TileLesuStorage) worldObj.getTileEntity(getPos().getX() + dir.offsetX, getPos().getY() + dir.offsetY, getPos().getZ() + dir.offsetZ)).network;
if (!countedNetworks.contains(network)) {
if (network.master == null || network.master == this) {
connectedBlocks += network.storages.size();

View file

@ -12,9 +12,9 @@ public class TileLesuStorage extends TileMachineBase {
public void updateEntity() {
super.updateEntity();
if (network == null) {
findAndJoinNetwork(worldObj, xCoord, yCoord, zCoord);
findAndJoinNetwork(worldObj, getPos().getX(), getPos().getY(), getPos().getZ());
} 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;
}
}
@ -54,6 +54,6 @@ public class TileLesuStorage extends TileMachineBase {
public final void rebuildNetwork() {
this.removeFromNetwork();
this.resetNetwork();
this.findAndJoinNetwork(worldObj, xCoord, yCoord, zCoord);
this.findAndJoinNetwork(worldObj, getPos().getX(), getPos().getY(), getPos().getZ());
}
}