Lambda Posted December 29, 2016 Posted December 29, 2016 Hey there! So I'm trying to change a BlockPos every time 'air' is found.. Right now, I'm trying to move it down, however, it seems that it resets after doing so: [16:42:43] [server thread/INFO]: [sTDOUT]: BlockPos{x=-274, y=62, z=239} //changed [16:42:43] [server thread/INFO]: [sTDOUT]: BlockPos{x=-274, y=63, z=239} //resets Here is the code: public void digDown() { BlockPos posToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); IBlockState block = world.getBlockState(posToBreak); if(block.getBlock() == Blocks.AIR) { posToBreak.add(0,-1,0); System.out.println(posToBreak.add(0,-1,0)); System.out.println(posToBreak); System.out.print("im being called"); }else if(!(block instanceof TileEntity)) { world.destroyBlock(posToBreak, false); }else { handleTEBreaking((TileEntity) block, this.getPos()); } } Thanks! Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 30, 2016 Author Posted December 30, 2016 I think 'add' returns a new instance: What I have: posToBreak.add(0,-1,0); add method: public BlockPos add(int x, int y, int z) { return x == 0 && y == 0 && z == 0 ? this : new BlockPos(this.getX() + x, this.getY() + y, this.getZ() + z); } Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Raycoms Posted December 30, 2016 Posted December 30, 2016 Like he said you need to: posToBreak = posToBreak.add(0,-1,0); Quote
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Oh! I thought that the add method in the BlockPos would do that! Derp on my part! Thanks! Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Hmm, to do posToBreak = posToBreak.add(0,-1,0); I need a global variable, however, trying to set a global variable ends up giving me some random coords: [17:53:28] [server thread/INFO]: [sTDOUT]: BlockPos{x=0, y=-1, z=0} [17:53:28] [Client thread/INFO]: [sTDOUT]: BlockPos{x=0, y=-1, z=0} with this as the gv: private BlockPos posToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); Or maybe im just fu*king stupid. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Well, trying to store a local vairble: BlockPos posToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); within the method: public void digDown() { BlockPos posToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); IBlockState block = world.getBlockState(posToBreak); if(block.getBlock() == Blocks.AIR) { posToBreak = posToBreak.add(0,-1,0); }else if(!(block instanceof TileEntity)) { world.destroyBlock(posToBreak, false); }else { handleTEBreaking((TileEntity) block, this.getPos()); } } Will make posToBreak = posToBreak.add(0,-1,0); redundant, because it never actually changes anything. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Yeah just realized that! Yes this is inside a TE.. Yeah but storing a local variable, BlockPos posToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); with the method in the last post, always seems to return: [18:16:59] [server thread/INFO]: [sTDOUT]: BlockPos{x=-280, y=63, z=234} [18:16:59] [server thread/INFO]: [sTDOUT]: BlockPos{x=-280, y=63, z=234} Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 public class TE extends TileEntity { public BlockPos position; // Global variable public void doesNothing() { BlockPos position; // Local variable } } Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 [snip]Please don't just throw copy-pasta code at people who don't even know what a variable is... This helps nobody. I didn't mean for it to be copy pasta code I will modify that right now. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Well, sorry for making this over complicated for myself and you guys.. got it working now Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Well, now it still kinda messes with the positions, I have to relog 3-4 times before it works, then all the blocks mine at the same position... here is the code: public void digDown() { if(blockToBreak == null) { blockToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); }else { IBlockState block = world.getBlockState(blockToBreak); if (block.getBlock() == Blocks.AIR) { blockToBreak = blockToBreak.down(); } else { world.destroyBlock(blockToBreak, false); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); } if (blockToBreak.getY() < 0) { isRunning = true; } } } Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 Well, now it still kinda messes with the positions, I have to relog 3-4 times before it works, then all the blocks mine at the same position... here is the code: public void digDown() { if(blockToBreak == null) { blockToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); }else { IBlockState block = world.getBlockState(blockToBreak); if (block.getBlock() == Blocks.AIR) { blockToBreak = blockToBreak.down(); } else { world.destroyBlock(blockToBreak, false); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); } if (blockToBreak.getY() < 0) { isRunning = true; } } } Where are you calling it from? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Update Function. with !world.isRemote. Edit: here is the entire class: public class TileEntityGeothermicPump extends TileEntityBase implements IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(250000, 0, 50); public static final int PRODUCE = 35; public static final int PROBE_USE = 10; private static BlockPos blockToBreak; public static int DEATH_TICK = 10; public boolean isBroke = false; public boolean isRunning = false; private int tick; private int deathTick; public TileEntityGeothermicPump() { super("geothermicPump"); } @Override public void updateEntity() { super.updateEntity(); if(!world.isRemote) { deathTick++; tick++; System.out.println(tick); if(tick >= 25) { digDown(); tick=0; } //deathTicking(); } } public void digDown() { if(blockToBreak == null) { blockToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); }else { IBlockState block = world.getBlockState(blockToBreak); if (block.getBlock() == Blocks.AIR) { blockToBreak = blockToBreak.down(); } else { world.destroyBlock(blockToBreak, false); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); } if (blockToBreak.getY() < 0) { isRunning = true; } } } public void deathTicking() { if(isRunning) { if (deathTick >= 100) { DEATH_TICK--; deathTick = 0; } if (DEATH_TICK <= 0) { //placeDestroyedBlocks(this.getPos().getY()); isBroke = true; } } } public void handleTEBreaking(TileEntity tileEntity, BlockPos basePos) { if(tileEntity != null) { BlockPos posToSend = new BlockPos(basePos.getX(), basePos.getY()+1, basePos.getZ()); IBlockState blockOccupy = this.world.getBlockState(posToSend); if(blockOccupy.getBlock() instanceof BlockContainer) { tileEntity.setPos(posToSend); renderEffect(EnumParticleTypes.PORTAL, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ(), posToSend.getX(), posToSend.getY(), posToSend.getZ()); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); }else { posToSend.add(0, 1, 0); return; } } } public void renderStaticEffect(EnumParticleTypes type, double startX, double startY, double startZ) { ((WorldServer)this.world).spawnParticle(type, false, startX, startY, startZ, 2, 0, 0, 0, 0.1D); } public void renderEffect(EnumParticleTypes type, double startX, double startY, double startZ, double endX, double endY, double endZ) { this.world.spawnParticle(type, startX, startY, startZ, endX, endY, endZ); } //todo replace bedrock with last two blocks public void placeDestroyedBlocks(){ //todo REWRITE! WAS BREAKING! } @Override public CustomEnergyStorage getEnergyStorage() { return storage; } @Override public boolean needsHoldShift() { return false; } public boolean isRunning() { return isRunning; } public void setRunning(boolean running) { isRunning = running; } } Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 Update Function. with !world.isRemote. Edit: here is the entire class: public class TileEntityGeothermicPump extends TileEntityBase implements IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(250000, 0, 50); public static final int PRODUCE = 35; public static final int PROBE_USE = 10; private static BlockPos blockToBreak; public static int DEATH_TICK = 10; public boolean isBroke = false; public boolean isRunning = false; private int tick; private int deathTick; public TileEntityGeothermicPump() { super("geothermicPump"); } @Override public void updateEntity() { super.updateEntity(); if(!world.isRemote) { deathTick++; tick++; System.out.println(tick); if(tick >= 25) { digDown(); tick=0; } //deathTicking(); } } public void digDown() { if(blockToBreak == null) { blockToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); }else { IBlockState block = world.getBlockState(blockToBreak); if (block.getBlock() == Blocks.AIR) { blockToBreak = blockToBreak.down(); } else { world.destroyBlock(blockToBreak, false); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); } if (blockToBreak.getY() < 0) { isRunning = true; } } } public void deathTicking() { if(isRunning) { if (deathTick >= 100) { DEATH_TICK--; deathTick = 0; } if (DEATH_TICK <= 0) { //placeDestroyedBlocks(this.getPos().getY()); isBroke = true; } } } public void handleTEBreaking(TileEntity tileEntity, BlockPos basePos) { if(tileEntity != null) { BlockPos posToSend = new BlockPos(basePos.getX(), basePos.getY()+1, basePos.getZ()); IBlockState blockOccupy = this.world.getBlockState(posToSend); if(blockOccupy.getBlock() instanceof BlockContainer) { tileEntity.setPos(posToSend); renderEffect(EnumParticleTypes.PORTAL, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ(), posToSend.getX(), posToSend.getY(), posToSend.getZ()); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); }else { posToSend.add(0, 1, 0); return; } } } public void renderStaticEffect(EnumParticleTypes type, double startX, double startY, double startZ) { ((WorldServer)this.world).spawnParticle(type, false, startX, startY, startZ, 2, 0, 0, 0, 0.1D); } public void renderEffect(EnumParticleTypes type, double startX, double startY, double startZ, double endX, double endY, double endZ) { this.world.spawnParticle(type, startX, startY, startZ, endX, endY, endZ); } //todo replace bedrock with last two blocks public void placeDestroyedBlocks(){ //todo REWRITE! WAS BREAKING! } @Override public CustomEnergyStorage getEnergyStorage() { return storage; } @Override public boolean needsHoldShift() { return false; } public boolean isRunning() { return isRunning; } public void setRunning(boolean running) { isRunning = running; } } Could you show your TileEntityBase and IEnergyDisplay? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Draco18s Posted December 30, 2016 Posted December 30, 2016 if (blockToBreak.getY() < 0) { isRunning = true; } Uh? Are you sure? Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Yes, that has nothing to do with the function of the blocks breaking, this basically opens a 'portal' to a void and creates energy from it.. reason why i need the blocks to break.. the isRunning boolean is so it knows that it has it the void. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Update Function. with !world.isRemote. Edit: here is the entire class: public class TileEntityGeothermicPump extends TileEntityBase implements IEnergyDisplay { public final CustomEnergyStorage storage = new CustomEnergyStorage(250000, 0, 50); public static final int PRODUCE = 35; public static final int PROBE_USE = 10; private static BlockPos blockToBreak; public static int DEATH_TICK = 10; public boolean isBroke = false; public boolean isRunning = false; private int tick; private int deathTick; public TileEntityGeothermicPump() { super("geothermicPump"); } @Override public void updateEntity() { super.updateEntity(); if(!world.isRemote) { deathTick++; tick++; System.out.println(tick); if(tick >= 25) { digDown(); tick=0; } //deathTicking(); } } public void digDown() { if(blockToBreak == null) { blockToBreak = new BlockPos(this.getPos().getX(), this.getPos().getY()-1, this.getPos().getZ()); }else { IBlockState block = world.getBlockState(blockToBreak); if (block.getBlock() == Blocks.AIR) { blockToBreak = blockToBreak.down(); } else { world.destroyBlock(blockToBreak, false); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); } if (blockToBreak.getY() < 0) { isRunning = true; } } } public void deathTicking() { if(isRunning) { if (deathTick >= 100) { DEATH_TICK--; deathTick = 0; } if (DEATH_TICK <= 0) { //placeDestroyedBlocks(this.getPos().getY()); isBroke = true; } } } public void handleTEBreaking(TileEntity tileEntity, BlockPos basePos) { if(tileEntity != null) { BlockPos posToSend = new BlockPos(basePos.getX(), basePos.getY()+1, basePos.getZ()); IBlockState blockOccupy = this.world.getBlockState(posToSend); if(blockOccupy.getBlock() instanceof BlockContainer) { tileEntity.setPos(posToSend); renderEffect(EnumParticleTypes.PORTAL, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ(), posToSend.getX(), posToSend.getY(), posToSend.getZ()); renderStaticEffect(EnumParticleTypes.END_ROD, blockToBreak.getX(), blockToBreak.getY(), blockToBreak.getZ()); }else { posToSend.add(0, 1, 0); return; } } } public void renderStaticEffect(EnumParticleTypes type, double startX, double startY, double startZ) { ((WorldServer)this.world).spawnParticle(type, false, startX, startY, startZ, 2, 0, 0, 0, 0.1D); } public void renderEffect(EnumParticleTypes type, double startX, double startY, double startZ, double endX, double endY, double endZ) { this.world.spawnParticle(type, startX, startY, startZ, endX, endY, endZ); } //todo replace bedrock with last two blocks public void placeDestroyedBlocks(){ //todo REWRITE! WAS BREAKING! } @Override public CustomEnergyStorage getEnergyStorage() { return storage; } @Override public boolean needsHoldShift() { return false; } public boolean isRunning() { return isRunning; } public void setRunning(boolean running) { isRunning = running; } } Could you show your TileEntityBase and IEnergyDisplay? I highly that its something to do with these classes, but: TileEntityBase: public abstract class TileEntityBase extends TileEntity implements ITickable{ public final String name; public boolean isRedstonePowered; public boolean isPulseMode; public boolean stopFromDropping; protected int ticksElapsed; protected TileEntity[] tilesAround = new TileEntity[6]; protected boolean hasSavedDataOnChangeOrWorldStart; public TileEntityBase(String name){ this.name = name; } public static void init() { ModUtil.LOGGER.info("Registering TileEntities..."); register(TileEntityConstructor.class); register(TileEntityGeothermicPump.class); register(TileEntityItemBuffer.class); } private static void register(Class<? extends TileEntityBase> tileClass){ try{ String name = ModUtil.MOD_ID+":"+tileClass.newInstance().name; GameRegistry.registerTileEntity(tileClass, name); } catch(Exception e){ ModUtil.LOGGER.fatal("Registering a TileEntity failed!", e); } } @Override public final NBTTagCompound writeToNBT(NBTTagCompound compound){ this.writeSyncableNBT(compound, NBTType.SAVE_TILE); return compound; } @Override public final void readFromNBT(NBTTagCompound compound){ this.readSyncableNBT(compound, NBTType.SAVE_TILE); } @Override public final SPacketUpdateTileEntity getUpdatePacket(){ NBTTagCompound compound = new NBTTagCompound(); this.writeSyncableNBT(compound, NBTType.SYNC); return new SPacketUpdateTileEntity(this.pos, -1, compound); } @Override public final void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt){ this.readSyncableNBT(pkt.getNbtCompound(), NBTType.SYNC); } @Override public final NBTTagCompound getUpdateTag(){ NBTTagCompound compound = new NBTTagCompound(); this.writeSyncableNBT(compound, NBTType.SYNC); return compound; } @Override public final void handleUpdateTag(NBTTagCompound compound){ this.readSyncableNBT(compound, NBTType.SYNC); } public final void sendUpdate(){ if(this.world != null && !this.world.isRemote){ NBTTagCompound compound = new NBTTagCompound(); this.writeSyncableNBT(compound, NBTType.SYNC); NBTTagCompound data = new NBTTagCompound(); data.setTag("Data", compound); data.setInteger("X", this.pos.getX()); data.setInteger("Y", this.pos.getY()); data.setInteger("Z", this.pos.getZ()); PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(data, PacketHandler.TILE_ENTITY_HANDLER), new NetworkRegistry.TargetPoint(this.world.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64)); } } public void writeSyncableNBT(NBTTagCompound compound, NBTType type){ if(type != NBTType.SAVE_BLOCK){ super.writeToNBT(compound); } if(type == NBTType.SAVE_TILE){ compound.setBoolean("Redstone", this.isRedstonePowered); compound.setInteger("TicksElapsed", this.ticksElapsed); compound.setBoolean("StopDrop", this.stopFromDropping); } if(this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)){ compound.setBoolean("IsPulseMode", this.isPulseMode); } } public void readSyncableNBT(NBTTagCompound compound, NBTType type){ if(type != NBTType.SAVE_BLOCK){ super.readFromNBT(compound); } if(type == NBTType.SAVE_TILE){ this.isRedstonePowered = compound.getBoolean("Redstone"); this.ticksElapsed = compound.getInteger("TicksElapsed"); this.stopFromDropping = compound.getBoolean("StopDrop"); } if(this.isRedstoneToggle()){ this.isPulseMode = compound.getBoolean("IsPulseMode"); } } @Override public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState){ return !oldState.getBlock().isAssociatedBlock(newState.getBlock()); } public String getDisplayedName(){ return StringUtil.localize("container."+ModUtil.MOD_ID+"."+this.name+".name"); } @Override public ITextComponent getDisplayName(){ return new TextComponentString(this.getDisplayedName()); } /** * !WORLD.ISREMOTE */ @Override public final void update(){ this.updateEntity(); } public int getComparatorStrength(){ return 0; } public void updateEntity(){ this.ticksElapsed++; if(!this.world.isRemote){ if(this instanceof ISharingEnergyHandler){ ISharingEnergyHandler provider = (ISharingEnergyHandler)this; if(provider.doesShareEnergy()){ int total = provider.getEnergyToSplitShare(); if(total > 0){ EnumFacing[] sides = provider.getEnergyShareSides(); int amount = total/sides.length; if(amount <= 0){ amount = total; } for(EnumFacing side : sides){ TileEntity tile = this.tilesAround[side.ordinal()]; if(tile != null && provider.canShareTo(tile)){ WorldUtil.doEnergyInteraction(this, tile, side, amount); } } } } } if(this instanceof ISharingFluidHandler){ ISharingFluidHandler handler = (ISharingFluidHandler)this; if(handler.doesShareFluid()){ int total = handler.getMaxFluidAmountToSplitShare(); if(total > 0){ EnumFacing[] sides = handler.getFluidShareSides(); int amount = total/sides.length; if(amount <= 0){ amount = total; } for(EnumFacing side : sides){ TileEntity tile = this.tilesAround[side.ordinal()]; if(tile != null){ WorldUtil.doFluidInteraction(this, tile, side, amount); } } } } } if(!this.hasSavedDataOnChangeOrWorldStart){ if(this.shouldSaveDataOnChangeOrWorldStart()){ this.saveDataOnChangeOrWorldStart(); } this.hasSavedDataOnChangeOrWorldStart = true; } } } public void saveDataOnChangeOrWorldStart(){ for(EnumFacing side : EnumFacing.values()){ this.tilesAround[side.ordinal()] = this.world.getTileEntity(this.pos.offset(side)); } } public boolean shouldSaveDataOnChangeOrWorldStart(){ return this instanceof ISharingEnergyHandler || this instanceof ISharingFluidHandler; } public void setRedstonePowered(boolean powered){ this.isRedstonePowered = powered; this.markDirty(); } public boolean canPlayerUse(EntityPlayer player){ return player.getDistanceSq(this.getPos().getX()+0.5D, this.pos.getY()+0.5D, this.pos.getZ()+0.5D) <= 64 && !this.isInvalid() && this.world.getTileEntity(this.pos) == this; } protected boolean sendUpdateWithInterval(){ if(this.ticksElapsed% ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0){ this.sendUpdate(); return true; } else{ return false; } } @Override public boolean hasCapability(Capability<?> capability, EnumFacing facing){ return this.getCapability(capability, facing) != null; } @Override public <T> T getCapability(Capability<T> capability, EnumFacing facing){ if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY){ IItemHandler handler = this.getItemHandler(facing); if(handler != null){ return (T)handler; } } else if(capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY){ IFluidHandler tank = this.getFluidHandler(facing); if(tank != null){ return (T)tank; } } else if(capability == CapabilityEnergy.ENERGY){ IEnergyStorage storage = this.getEnergyStorage(facing); if(storage != null){ return (T)storage; } } return super.getCapability(capability, facing); } public IFluidHandler getFluidHandler(EnumFacing facing){ return null; } public IEnergyStorage getEnergyStorage(EnumFacing facing){ return null; } public IItemHandler getItemHandler(EnumFacing facing){ return null; } public boolean isRedstoneToggle(){ return false; } public void activateOnPulse(){ } public boolean respondsToPulses(){ return this.isRedstoneToggle() && this.isPulseMode; } public enum NBTType{ SAVE_TILE, SYNC, SAVE_BLOCK } } IEnergyDisplay: public interface IEnergyDisplay{ @SideOnly(Side.CLIENT) CustomEnergyStorage getEnergyStorage(); @SideOnly(Side.CLIENT) boolean needsHoldShift(); } CustomEnergyStorage just extends MCForge's EnergyStorage. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 The digDown method posted works for me, is it being called? Is your TE being loaded? *Edit: make sure to save your blockToDestroy as well. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Yeah it should be.. Its not throwing a mapping error... and yes, I have it saved now, but still doesn't work Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 Yeah it should be.. Its not throwing a mapping error... and yes, I have it saved now, but still doesn't work Not registered, but instantiated/created. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Lambda Posted December 30, 2016 Author Posted December 30, 2016 How would I check that it is instantiated/created. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 How would I check that it is instantiated/created. You have printlns are they printing? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Yep, for some reason the blockpos is at 0,0,0 then goes down one every tick I tell it to dig.. only relogging many times fixes it. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Animefan8888 Posted December 30, 2016 Posted December 30, 2016 Yep, for some reason the blockpos is at 0,0,0 then goes down one every tick I tell it to dig.. only relogging many times fixes it. Try placing the block again. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Lambda Posted December 30, 2016 Author Posted December 30, 2016 Okay adding this: || (blockToBreak.getY() == 0 && blockToBreak.getZ() == 0 && blockToBreak.getZ() == 0)) to the if statement checking null, however, all the TE dig in the same place still.. Quote Relatively new to modding. Currently developing: https://github.com/LambdaXV/DynamicGenerators
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.