Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lambda

Members
  • Joined

  • Last visited

Everything posted by Lambda

  1. Yeah edited the post above java.lang.NullPointerException: Ticking block entity at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdate(TileEntityBase.java:106) at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdateWithInterval(TileEntityBase.java:231) at com.lambda.plentifulmisc.tile.TileEntityCoalGenerator.updateEntity(TileEntityCoalGenerator.java:82) at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:149) at net.minecraft.world.World.updateEntities(World.java:1968) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) at java.lang.Thread.run(Thread.java:745) at: if((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()){ and PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(data, PacketHandler.TILE_ENTITY_HANDLER), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 128)); Is there something wrong with my packets? here is the classes:
  2. Thanks for your response, however, I'm getting a new error posted above. Thanks again.
  3. Oh didnt see that. Anyways still getting the crash.
  4. I am here: EDIT: Just set it to a static value for now, anyways now I'm getting a crash: java.lang.NullPointerException: Ticking block entity at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdate(TileEntityBase.java:106) at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdateWithInterval(TileEntityBase.java:231) at com.lambda.plentifulmisc.tile.TileEntityCoalGenerator.updateEntity(TileEntityCoalGenerator.java:82) at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:149) at net.minecraft.world.World.updateEntities(World.java:1968) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) at java.lang.Thread.run(Thread.java:745) at: if((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()){ and PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(data, PacketHandler.TILE_ENTITY_HANDLER), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 128)); Is there something wrong with my packets? here is the classes:
  5. Yeah mb, anyways now I'm getting this after null checking. ---- Minecraft Crash Report ---- // Ouch. That hurt Time: 11/23/16 2:05 PM Description: Ticking block entity java.lang.ArithmeticException: / by zero at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdateWithInterval(TileEntityBase.java:230) at com.lambda.plentifulmisc.tile.TileEntityCoalGenerator.updateEntity(TileEntityCoalGenerator.java:82) at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:149) at net.minecraft.world.World.updateEntities(World.java:1968) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) at java.lang.Thread.run(Thread.java:745) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Server thread Stacktrace: at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdateWithInterval(TileEntityBase.java:230) at com.lambda.plentifulmisc.tile.TileEntityCoalGenerator.updateEntity(TileEntityCoalGenerator.java:82) at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:149) -- Block entity being ticked -- Details: Name: plentifulmisc:coalgenerator // com.lambda.plentifulmisc.tile.TileEntityCoalGenerator Block type: ID #236 (tile.plentifulmisc.coal_generator // com.lambda.plentifulmisc.blocks.BlockCoalGenerator) Block data value: 2 / 0x2 / 0b0010 Block location: World: (248,64,10), Chunk: (at 8,4,10 in 15,0; contains blocks 240,0,0 to 255,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Actual block type: ID #236 (tile.plentifulmisc.coal_generator // com.lambda.plentifulmisc.blocks.BlockCoalGenerator) Actual block data value: 2 / 0x2 / 0b0010 Stacktrace: at net.minecraft.world.World.updateEntities(World.java:1968) at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) -- Affected level -- Details: Level name: World All players: 0 total; [] Chunk stats: ServerChunkCache: 625 Drop: 0 Level seed: 8468416878428078370 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (256,64,12), Chunk: (at 0,4,12 in 16,0; contains blocks 256,0,0 to 271,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 853 game time, 853 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 141165 (now: false), thunder time: 13919 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) at java.lang.Thread.run(Thread.java:745) -- System Details -- Details: Minecraft Version: 1.11 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_91, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 751403968 bytes (716 MB) / 1540882432 bytes (1469 MB) up to 3814195200 bytes (3637 MB) JVM Flags: 0 total; IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP 9.35 Powered by Forge 13.19.0.2157 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.11-13.19.0.2157.jar) UCHIJAAAA forge{13.19.0.2157} [Minecraft Forge] (forgeSrc-1.11-13.19.0.2157.jar) UCHIJAAAA plentifulmisc{0.0.1} [Plentiful Misc] (1.1.1) Loaded coremods (and transformers): GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' I dont see anywhere where I divide by 0. here is my configIntValues: package com.lambda.plentifulmisc.config; /** * Created by Blake on 11/23/2016. */ public enum ConfigIntValues { TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 10, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client"), CTRL_INFO_NBT_CHAR_LIMIT("Advanced Info NBT Character Limit", ConfigCategories.OTHER, 1000, 0, 100000000, "The maximum amount of characters that is displayed by the NBT view of the CTRL Advanced Info. Set to a zero to have no limit"); public final String name; public final String category; public final int defaultValue; public final int min; public final int max; public final String desc; public int currentValue; ConfigIntValues(String name, ConfigCategories category, int defaultValue, int min, int max, String desc) { this.name = name; this.category = category.name; this.defaultValue = defaultValue; this.min = min; this.max = max; this.desc = desc; } public int getValue() { return this.currentValue; } }
  6. How would I make sure this doesnt happen or should I just nullcheck and return false? EDIT: if(!this.worldObj.isRemote && worldObj != null){ this in updateEntity didnt seem to work.
  7. Hello, So I have a custom tile entity here the uses cofh energy system. However, when I place fuel inside of it (coal) it seems to crash: net.minecraft.util.ReportedException: Ticking block entity at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:800) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) ~[integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91] Caused by: java.lang.NullPointerException at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdate(TileEntityBase.java:107) ~[TileEntityBase.class:?] at com.lambda.plentifulmisc.tile.TileEntityBase.sendUpdateWithInterval(TileEntityBase.java:232) ~[TileEntityBase.class:?] at com.lambda.plentifulmisc.tile.TileEntityCoalGenerator.updateEntity(TileEntityCoalGenerator.java:82) ~[TileEntityCoalGenerator.class:?] at com.lambda.plentifulmisc.tile.TileEntityBase.update(TileEntityBase.java:150) ~[TileEntityBase.class:?] at net.minecraft.world.World.updateEntities(World.java:1968) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:646) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) ~[MinecraftServer.class:?] ... 4 more [13:11:31] [server thread/ERROR]: This crash report has been saved to: F:\Minecraft Workspace\1.1.1\run\.\crash-reports\crash-2016-11-23_13.11.31-server.txt Looking into it, my sendUpdate() and sendUpdateWithInterval() functions seem to be outputting null, however i dont see why. Here is my TE Base: package com.lambda.plentifulmisc.tile; /** * Created by Blake on 11/23/2016. */ import com.lambda.plentifulmisc.config.ConfigIntValues; import com.lambda.plentifulmisc.network.PacketHandler; import com.lambda.plentifulmisc.network.PacketServerToClient; import com.lambda.plentifulmisc.util.ModUtil; import com.lambda.plentifulmisc.util.StringUtil; import com.lambda.plentifulmisc.util.WorldUtil; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; public abstract class TileEntityBase extends TileEntity implements ITickable{ public final String name; public boolean isRedstonePowered; public boolean isPulseMode; 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(TileEntityCoalGenerator.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.worldObj.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.worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 128)); } } 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); } } 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"); } } @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()); } @Override public final void update(){ this.updateEntity(); } public void updateEntity(){ this.ticksElapsed++; if(!this.worldObj.isRemote){ if(this instanceof ISharingEnergyProvider){ ISharingEnergyProvider provider = (ISharingEnergyProvider)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){ 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.worldObj.getTileEntity(this.pos.offset(side)); } } public boolean shouldSaveDataOnChangeOrWorldStart(){ return this instanceof ISharingEnergyProvider || 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.worldObj.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 == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) { IFluidHandler tank = this.getFluidHandler(facing); if (tank != null) { return (T) tank; } } return super.getCapability(capability, facing); } public IFluidHandler getFluidHandler(EnumFacing facing){ return null; } public boolean isRedstoneToggle(){ return false; } public void activateOnPulse(){ } public enum NBTType{ SAVE_TILE, SYNC, SAVE_BLOCK } } and my TE Coal generator: package com.lambda.plentifulmisc.tile; /** * Created by Blake on 11/23/2016. */ import cofh.api.energy.EnergyStorage; import com.lambda.plentifulmisc.util.StackUtil; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityCoalGenerator extends TileEntityInventoryBase implements ISharingEnergyProvider{ public static final int PRODUCE = 45; public final CustomEnergyStorage storage = new CustomEnergyStorage(125000, 125); public int maxBurnTime; public int currentBurnTime; private int lastEnergy; private int lastBurnTime; private int lastCurrentBurnTime; public TileEntityCoalGenerator(){ super(1, "coalGenerator"); } @SideOnly(Side.CLIENT) public int getEnergyScaled(int i){ return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored(); } @SideOnly(Side.CLIENT) public int getBurningScaled(int i){ return this.currentBurnTime*i/this.maxBurnTime; } @Override public void writeSyncableNBT(NBTTagCompound compound, NBTType type){ if(type != NBTType.SAVE_BLOCK){ compound.setInteger("BurnTime", this.currentBurnTime); compound.setInteger("MaxBurnTime", this.maxBurnTime); } this.storage.writeToNBT(compound); super.writeSyncableNBT(compound, type); } @Override public void readSyncableNBT(NBTTagCompound compound, NBTType type){ if(type != NBTType.SAVE_BLOCK){ this.currentBurnTime = compound.getInteger("BurnTime"); this.maxBurnTime = compound.getInteger("MaxBurnTime"); } this.storage.readFromNBT(compound); super.readSyncableNBT(compound, type); } @Override public void updateEntity(){ super.updateEntity(); if(!this.worldObj.isRemote){ boolean flag = this.currentBurnTime > 0; if(this.currentBurnTime > 0){ this.currentBurnTime--; this.storage.receiveEnergyInternal(PRODUCE, false); } if(this.currentBurnTime <= 0 && StackUtil.isValid(this.slots.get(0)) && TileEntityFurnace.getItemBurnTime(this.slots.get(0)) > 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()){ int burnTime = TileEntityFurnace.getItemBurnTime(this.slots.get(0)); this.maxBurnTime = burnTime; this.currentBurnTime = burnTime; this.slots.set(0, StackUtil.addStackSize(this.slots.get(0), -1)); } if(flag != this.currentBurnTime > 0){ this.markDirty(); } if((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); this.lastCurrentBurnTime = this.currentBurnTime; this.lastBurnTime = this.currentBurnTime; } } } @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return TileEntityFurnace.getItemBurnTime(stack) > 0; } @Override public boolean canInsertItem(int slot, ItemStack stack, EnumFacing side){ return this.isItemValidForSlot(slot, stack); } @Override public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){ return TileEntityFurnace.getItemBurnTime(this.slots.get(0)) <= 0; } @Override public int extractEnergy(EnumFacing from, int maxReceive, boolean simulate){ return this.storage.extractEnergy(maxReceive, simulate); } @Override public int getEnergyStored(EnumFacing from){ return this.storage.getEnergyStored(); } @Override public int getMaxEnergyStored(EnumFacing from){ return this.storage.getMaxEnergyStored(); } @Override public boolean canConnectEnergy(EnumFacing from){ return true; } @Override public int getEnergyToSplitShare(){ return this.storage.getEnergyStored(); } @Override public boolean doesShareEnergy(){ return true; } @Override public EnumFacing[] getEnergyShareSides(){ return EnumFacing.values(); } } Also, how would I sync my git with github? I used cloning, do I have to run it everytime I update the git? I'm using Intellj Thanks for your time.
  8. Hello, So I was updating my mod from 1.10 and found that 50% of block methods are now deprecated, should I just ignore this error? Here are some examples: @Override public boolean isFullCube(IBlockState state){ return false; } @Override public boolean isOpaqueCube(IBlockState state){ return false; } @Override public IBlockState withRotation(IBlockState state, Rotation r){ return state.withProperty(BlockHorizontal.FACING, r.rotate(state.getValue(BlockHorizontal.FACING))); } @Override public IBlockState withMirror(IBlockState state, Mirror mirror){ return this.withRotation(state, mirror.toRotation(state.getValue(BlockHorizontal.FACING))); } @Override public IBlockState getStateFromMeta(int meta){ return this.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(meta)); } @Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos){ super.neighborChanged(state, worldIn, pos, blockIn, otherPos); this.neighborsChangedCustom(worldIn, pos); } Actually, all of them.
  9. Oops bit of a typo, my bad! Edit: Had the wrong null list imported, didn't even see that
  10. Hello! So I was updating my mod and I found that NonNullList no longer exists, is there any replacement ex: public static boolean isIInvEmpty(NonNullList<ItemStack> slots) { for (ItemStack stack : slots) { if (StackUtil.isValid(stack)) { return false; } } return true; } and how would I find functions, such as: func_190926_b because this doesnt exist for an itemstack anymore Thanks!
  11. Sorry miss-worded that, I was trying to say my items were registering now, as previously they were not
  12. Okay, tried something a bit more basic, removed the hashmap( I dont really know why I did that in the first place ), now: - Block & Item(not ItemBlock) textures are registering - ItemBlock still 'unregistered' (default texture) Here is the updated code: ItemUtil package com.lambda.plentifulmisc.util; /** * Created by Blake on 11/22/2016. */ import com.lambda.plentifulmisc.PlentifulMisc; import com.lambda.plentifulmisc.blocks.base.ItemBlockBase; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public final class ItemUtil{ public static void registerBlock(Block block, ItemBlockBase itemBlock, String name, boolean addTab){ block.setUnlocalizedName(ModUtil.MOD_ID+"."+name); block.setRegistryName(ModUtil.MOD_ID, name); GameRegistry.register(block); itemBlock.setRegistryName(block.getRegistryName()); GameRegistry.register(itemBlock); block.setCreativeTab(addTab ? PlentifulMisc.instance.CREATIVE_TAB : null); } public static void registerItem(Item item, String name, boolean addTab){ item.setUnlocalizedName(ModUtil.MOD_ID+"."+name); item.setRegistryName(ModUtil.MOD_ID, name); GameRegistry.register(item); item.setCreativeTab(addTab ? PlentifulMisc.instance.CREATIVE_TAB : null); } } blockBase package com.lambda.plentifulmisc.blocks.base; import com.lambda.plentifulmisc.PlentifulMisc; import com.lambda.plentifulmisc.util.ItemUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.client.model.ModelLoader; /** * Created by Blake on 11/22/2016. */ public class BlockBase extends Block{ private final String name; public BlockBase(Material material, String name){ super(material); this.name = name; this.register(); } private void register(){ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative()); this.registerRendering(this.getItemBlock(), 0); } protected String getBaseName(){ return this.name; } protected ItemBlockBase getItemBlock(){ return new ItemBlockBase(this); } public boolean shouldAddCreative(){ return true; } protected void registerRendering(ItemBlock itemBlock, int metadata){ PlentifulMisc.proxy.registerRendering(itemBlock, metadata, new ModelResourceLocation(this.getRegistryName(), "inventory")); } } Client Proxy: package com.lambda.plentifulmisc.proxy; import com.lambda.plentifulmisc.blocks.base.BlockBase; import com.lambda.plentifulmisc.util.ModUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import java.util.*; /** * Created by Blake on 11/22/2016. */ public class ClientProxy implements IProxy { @Override public void preInit(FMLPreInitializationEvent event) { ModUtil.LOGGER.info("PreInitializing ClientProxy..."); } @Override public void init(FMLInitializationEvent event) { } @Override public void postInit(FMLPostInitializationEvent event) { } @Override public void registerRendering(ItemBlock itemBlock, int metadata, ModelResourceLocation location){ ModelLoader.setCustomModelResourceLocation(itemBlock, metadata, location); } @Override public void registerRenderingItem(Item item, int metadata, ModelResourceLocation location) { ModelLoader.setCustomModelResourceLocation(item, metadata, location); } } Block itself package com.lambda.plentifulmisc.blocks; import com.lambda.plentifulmisc.blocks.base.BlockBase; import com.lambda.plentifulmisc.util.ItemUtil; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; /** * Created by Blake on 11/22/2016. */ public class BlockCeleistrum extends BlockBase{ BlockCeleistrum(String name) { super(Material.ROCK, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(2.5F); this.setResistance(10.0F); this.setSoundType(SoundType.STONE); } }
  13. if(!(result.entityHit instanceof EntityPlayer))
  14. Client Proxy: package com.lambda.plentifulmisc.proxy; import com.lambda.plentifulmisc.util.ModUtil; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import java.util.*; /** * Created by Blake on 11/22/2016. */ public class ClientProxy implements IProxy { private static final Map<ItemStack, ModelResourceLocation> MODEL_LOCATIONS_FOR_REGISTERING = new HashMap<ItemStack, ModelResourceLocation>(); @Override public void preInit(FMLPreInitializationEvent event) { ModUtil.LOGGER.info("PreInitializing ClientProxy..."); for(Map.Entry<ItemStack, ModelResourceLocation> entry : MODEL_LOCATIONS_FOR_REGISTERING.entrySet()){ ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(), entry.getValue()); } } @Override public void init(FMLInitializationEvent event) { } @Override public void postInit(FMLPostInitializationEvent event) { } @Override public void addRenderRegister(ItemStack stack, ResourceLocation location, String variant) { MODEL_LOCATIONS_FOR_REGISTERING.put(stack, new ModelResourceLocation(location, variant)); } }
  15. Hello, So I'm having an issue with my itemblock not registering a texture. The console does not output any missing resourcelocation so I'm guessing its somewhere in my code, but I had no luck in finding it. Here is my ItemUtil class: package com.lambda.plentifulmisc.util; /** * Created by Blake on 11/22/2016. */ import com.lambda.plentifulmisc.PlentifulMisc; import com.lambda.plentifulmisc.blocks.base.ItemBlockBase; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.GameRegistry; import java.util.*; public final class ItemUtil{ public static Item getItemFromName(String name){ ResourceLocation resLoc = new ResourceLocation(name); if(Item.REGISTRY.containsKey(resLoc)){ return Item.REGISTRY.getObject(resLoc); } return null; } public static void registerBlock(Block block, ItemBlockBase itemBlock, String name, boolean addTab){ block.setUnlocalizedName(ModUtil.MOD_ID+"."+name); block.setRegistryName(ModUtil.MOD_ID, name); GameRegistry.register(block); itemBlock.setRegistryName(block.getRegistryName()); GameRegistry.register(itemBlock); block.setCreativeTab(addTab ? PlentifulMisc.instance.CREATIVE_TAB : null); } public static void registerItem(Item item, String name, boolean addTab){ item.setUnlocalizedName(ModUtil.MOD_ID+"."+name); item.setRegistryName(ModUtil.MOD_ID, name); GameRegistry.register(item); item.setCreativeTab(addTab ? PlentifulMisc.instance.CREATIVE_TAB : null); } } Here is my BlockBase: package com.lambda.plentifulmisc.blocks.base; import com.lambda.plentifulmisc.PlentifulMisc; import com.lambda.plentifulmisc.util.ItemUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; /** * Created by Blake on 11/22/2016. */ public class BlockBase extends Block{ private final String name; public BlockBase(Material material, String name){ super(material); this.name = name; this.register(); } private void register(){ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative()); this.registerRendering(); } protected String getBaseName(){ return this.name; } protected ItemBlockBase getItemBlock(){ return new ItemBlockBase(this); } public boolean shouldAddCreative(){ return true; } protected void registerRendering(){ PlentifulMisc.proxy.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory"); } } Here is my Block Class package com.lambda.plentifulmisc.blocks; import com.lambda.plentifulmisc.blocks.base.BlockBase; import com.lambda.plentifulmisc.blocks.base.ItemBlockBase; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.ItemStack; /** * Created by Blake on 11/22/2016. */ public class BlockCeleistrum extends BlockBase{ BlockCeleistrum(String name) { super(Material.ROCK, name); this.setHarvestLevel("pickaxe", 0); this.setHardness(2.5F); this.setResistance(10.0F); this.setSoundType(SoundType.STONE); } } Lastly, my BlockInit: package com.lambda.plentifulmisc.blocks; import com.lambda.plentifulmisc.util.ModUtil; import net.minecraft.block.Block; /** * Created by Blake on 11/22/2016. */ public class InitBlocks { public static Block blockCeleistrum; public static void init() { ModUtil.LOGGER.info("Initializing Blocks..."); blockCeleistrum = new BlockCeleistrum("block_celestrium"); } } Thanks!

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.