Jump to content

Tschipp

Forge Modder
  • Posts

    307
  • Joined

  • Last visited

Posts posted by Tschipp

  1. Make a class called EventHandler and write this:

    	@SubscribeEvent
    	public void onModelRegistry(ModelRegistryEvent event)
    	{
    		ModItems.registerRenders();
    	}

     

    Then, during the Init phase, call 

    		MinecraftForge.EVENT_BUS.register(new EventHandler());

     

    Your registerRender() method in your ModItems class needs to look like this:

    private static void registerRender(Item item)
    {
    	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
    }

     

  2. 3 minutes ago, diesieben07 said:

    You can put whatever data you need from the TileEntity into the block state either using getActualState (if the amount of states is enumerable) or getExtendedState (for this you will need a custom runtime model).

    I don't think I can use states, I'm making a block that can look like any other block. The tile entity stores a Blockstate value and the block is supposed to look like that blockstate

  3. 1 minute ago, V0idWa1k3r said:

    Blocks do not have any NBT data associated with them. Do you mean ItemBlocks or TileEntities?

    ItemBlocks are not different from regular items in this regard.

    You can use Block::getActualState to return an IBlockState that relies on something like a TileEntity to define values for some of it's properties. See BlockFlowerPot for more details and an example.

    Yeah sorry I meant TileEntities... long day

  4. That might be it, gonna check it out

    EDIT: Looks like player is called "player", but the font renderer is called "fontRendererObj". Gonna check out the Actually additions source code

     

    EDIT 2: Weird, actually additions also uses fontRendererObj... I'm gonna try to setupDecompWorkspace again

  5. 15 hours ago, tommyte said:

    Does everything work fine without that mod?

    Yes, If I remove all other mods it works fine. I just have no idea why fields like player or fontRenderer would be missing... IIRC those are client only fields, so the issue might have to do with some client-only stuff. I was working on GUIs for my mod, I might have broken some stuff and just not noticed it... Gonna check

  6. When I got onto my dev environment today, I launched and tried to enter a world. It crashed immediately. Even trying to create a new world crashes me.

    The weird thing is, I didn't change anything from yesterday, and yesterday it all worked fine.

    This is one of the errors that I'm getting:

    [20:22:45] [Server thread/FATAL]: Error executing task
    java.util.concurrent.ExecutionException: java.lang.NoSuchFieldError: player
    	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_131]
    	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_131]
    	at net.minecraft.util.Util.runTask(Util.java:27) [Util.class:?]
    	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:753) [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(Unknown Source) [?:1.8.0_131]
    Caused by: java.lang.NoSuchFieldError: player
    	at mcjty.theoneprobe.network.PacketGetInfo$Handler.handle(PacketGetInfo.java:110) ~[PacketGetInfo$Handler.class:?]
    	at mcjty.theoneprobe.network.PacketGetInfo$Handler.lambda$onMessage$0(PacketGetInfo.java:103) ~[PacketGetInfo$Handler.class:?]
    	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_131]
    	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_131]
    	at net.minecraft.util.Util.runTask(Util.java:26) ~[Util.class:?]
    	... 5 more

     

    Or this one (similar):

    [20:27:19] [Netty Server IO #1/ERROR] [FML]: There was a critical exception handling a packet on channel XU2
    java.lang.NoSuchFieldError: player
    	at com.rwtema.extrautils2.XUProxy.getPlayerFromNetHandler(XUProxy.java:66) ~[XUProxy.class:?]
    	at com.rwtema.extrautils2.XUProxyClient.getPlayerFromNetHandler(XUProxyClient.java:73) ~[XUProxyClient.class:?]
    	at com.rwtema.extrautils2.network.PacketCodec.decodeInto(PacketCodec.java:53) ~[PacketCodec.class:?]
    	at com.rwtema.extrautils2.network.PacketCodec.decodeInto(PacketCodec.java:18) ~[PacketCodec.class:?]
    	at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:103) ~[FMLIndexedMessageToMessageCodec.class:?]
    	at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.decode(FMLIndexedMessageToMessageCodec.java:40) ~[FMLIndexedMessageToMessageCodec.class:?]
    	at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81) ~[MessageToMessageCodec$2.class:4.0.23.Final]
    	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[MessageToMessageDecoder.class:4.0.23.Final]
    	at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.0.23.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) ~[DefaultChannelPipeline.class:4.0.23.Final]
    	at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:169) ~[EmbeddedChannel.class:4.0.23.Final]
    	at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.processPacket(FMLProxyPacket.java:111) [FMLProxyPacket.class:?]
    	at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:156) [NetworkManager.class:?]
    	at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:51) [NetworkManager.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.0.23.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
    	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:452) [NetworkDispatcher.class:?]
    	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:274) [NetworkDispatcher.class:?]
    	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:73) [NetworkDispatcher.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.0.23.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [AbstractChannelHandlerContext.class:4.0.23.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:319) [AbstractChannelHandlerContext.class:4.0.23.Final]
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:787) [DefaultChannelPipeline.class:4.0.23.Final]
    	at io.netty.channel.local.LocalChannel.finishPeerRead(LocalChannel.java:326) [LocalChannel.class:4.0.23.Final]
    	at io.netty.channel.local.LocalChannel.access$400(LocalChannel.java:45) [LocalChannel.class:4.0.23.Final]
    	at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:312) [LocalChannel$5.class:4.0.23.Final]
    	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [SingleThreadEventExecutor.class:4.0.23.Final]
    	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [NioEventLoop.class:4.0.23.Final]
    	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [SingleThreadEventExecutor$2.class:4.0.23.Final]
    	at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]

     

    Or this one:

    [20:28:10] [Client thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.RenderGameOverlayEvent$Post@6c15605e:
    java.lang.NoSuchFieldError: fontRenderer
    	at de.ellpeck.actuallyadditions.mod.event.ClientEvents.onGameOverlay(ClientEvents.java:180) ~[ClientEvents.class:?]
    	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_132_ClientEvents_onGameOverlay_Post.invoke(.dynamic) ~[?:?]
    	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
    	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?]
    	at net.minecraftforge.client.GuiIngameForge.post(GuiIngameForge.java:889) [GuiIngameForge.class:?]
    	at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:205) [GuiIngameForge.class:?]
    	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1142) [EntityRenderer.class:?]
    	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1140) [Minecraft.class:?]
    	at net.minecraft.client.Minecraft.run(Minecraft.java:407) [Minecraft.class:?]
    	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
    	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_131]
    	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_131]
    	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    	at GradleStart.main(GradleStart.java:26) [start/:?]

     

    I honestly have no clue how this is happening. 

    Yes, as you can see I'm using other mods, but they worked fine before...

    I use all of these mods:

    d4845dd0c969ea70fd3d03c6698b3483.png

     

    If you have any Idea what may be causing this, please let me know!

     

  7. On 20.6.2017 at 2:43 PM, TheMattyBoy said:

    What I did was to just put Entity#setSize([width of grown animal] * [a factor that goes from the smallest size* when it's a baby, up to 1 when it's an adult], [height of grown animal] * [the same factor]); in EntityLivingBase#onLivingUpdate. In order to calculate the factor I would need to see your code for handling aging, unless you could figure it out yourself?

     

    *By the smallest size I mean say if the smallest version of the animal was 20% the size of the adult one, the "smallest size" would be 0.2, if it was 10% it would be 0.1 etc.

    Thanks, gonna try that

     

  8. Hi, I have an Animal that grows with a smooth animation (meaning it grows continuously until it reaches adult size).

    It has a value for its age, and I now want to be able to have a dynamic hitbox, meaning that the animal grows together with the render scale.

    How would I accomplish such a thing?

  9. With the old IInventory, you could specify which slots would be accessed from what side.

    How can I do the same with ItemHandlers? I want to make an input slot (0) that allows the player to remove the item, but not pipes (or only from below), so that the process

    of the machine doesn't get interrupted by the pipe pulling out the ingredients.

    In short: I want the pipes to be able to only access the output slots (1 and 2).

     

    I currently have this code:

    package tschipp.pathology.tileentity.handler;
    
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.nbt.NBTTagList;
    import net.minecraftforge.common.util.Constants;
    import net.minecraftforge.items.ItemStackHandler;
    import tschipp.pathology.item.PAItems;
    
    public class ItemHandlerMicroscope extends ItemStackHandler {
    
    	public ItemHandlerMicroscope() {
    		super(3);
    		this.setSize(3);
    	}
    
    
    	@Override
    	public void deserializeNBT(NBTTagCompound nbt)
    	{
    		setSize(3);
    		NBTTagList tagList = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND);
    		for (int i = 0; i < tagList.tagCount(); i++)
    		{
    			NBTTagCompound itemTags = tagList.getCompoundTagAt(i);
    			int slot = itemTags.getInteger("Slot");
    
    			if (slot >= 0 && slot < stacks.size())
    			{
    				stacks.set(slot, new ItemStack(itemTags));
    			}
    		}
    		onLoad();
    	}
    
    
    	@Override
    	public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
    
    		if(slot == 0 && !stack.isEmpty() && (stack.getItem() == PAItems.bloodSyringe) || (stack.getItem() == PAItems.virusSyringe && !stack.hasTagCompound() || !stack.getTagCompound().hasKey("researched") || !stack.getTagCompound().getBoolean("researched")))
    			return super.insertItem(slot, stack, simulate);
    		else return stack;
    	}
    
    
    	public void insertSyringe(int slot, ItemStack stack)
    	{
    		ItemStack slotStack = this.getStackInSlot(slot);
    		int count = slotStack.getCount();
    		if(count == 0)
    			this.setStackInSlot(slot, stack);
    		else
    		{
    			slotStack.setCount(count + 1);
    		}
    
    	}
    
    }

     

    Any help is very much appreciated

  10. 8 minutes ago, diesieben07 said:

    Sure it is. Write yourself a little generator script that generates them and run it when you need it.

    Sure, but can I include it in a mod? My thought was of making a library that automatically registers stuff and also generates the jsons

     

  11. I was wondering if it's possible to generate json model files for things like simple items and blocks.

    These models would only be generated if the file doesn't already exist in the assets folder, and it would generate it directly in the mod's asset folder.

    Is such a thing even possible?

  12. 14 minutes ago, diesieben07 said:

    The IFluidHandlerItem might have to create a new ItemStack to allow for the modifications (e.g. when emptying a vanilla bucket, because they are different items). You can access the "up to date" stack with IFluidHandlerItem::getContainer. In this case you have to put it back in the player's hand.

    That did the trick, thanks!

  13. @Override
    	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
    			EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    
    		ItemStack heldItem = playerIn.getHeldItem(hand);
    		
    		TileEntityTrough te = (TileEntityTrough) worldIn.getTileEntity(pos);
    
    		if (worldIn.isRemote) {
    			return true;
     
    		}  
    		//SOLIDS
    		else if(!heldItem.isEmpty() && heldItem.getItem() == Items.WHEAT)
    		{
    			if((!te.itemHandler.getStackInSlot(0).isEmpty() && te.itemHandler.getStackInSlot(0).getCount() < 3) || te.itemHandler.getStackInSlot(0).isEmpty() && te.fluidHandler.getFluid() == null)
    			{
    				te.itemHandler.insertItem(0, new ItemStack(Items.WHEAT), false);
    				if(!playerIn.isCreative())
    					heldItem.shrink(1);
    				return true;
    			}
    
    		}
    		//LIQUIDS
    		else if(hasFluid(heldItem, FluidRegistry.WATER) && te.itemHandler.getStackInSlot(0).isEmpty())
    		{
    			te.fluidHandler.fill(new FluidStack(FluidRegistry.WATER, 1000), true);
    			worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.PLAYERS, 0.6F, 0.8F);
    			if(!playerIn.isCreative())
    				FluidUtil.getFluidHandler(heldItem).drain(1000, true);
    			return true;
    
    		}
    		else if(hasFluid(heldItem, BlockHandler.fluidSlop) && te.itemHandler.getStackInSlot(0).isEmpty())
    		{
    			te.fluidHandler.fill(new FluidStack(BlockHandler.fluidSlop, 1000), true);
    			worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_SLIME_PLACE, SoundCategory.PLAYERS, 0.6F, 0.8F);
    			if(!playerIn.isCreative())
    			{
    				FluidStack fluid = FluidUtil.getFluidHandler(heldItem).drain(1000, true);
    			}
    			return true;
    
    		}
    		return false;
    
    	}

     

  14. Block#onBlockActivated, but only if !world.isRemote

     

    else if(hasFluid(heldItem, BlockHandler.fluidSlop) && te.itemHandler.getStackInSlot(0).isEmpty())
    		{
    			te.fluidHandler.fill(new FluidStack(BlockHandler.fluidSlop, 1000), true);
    			worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_SLIME_PLACE, SoundCategory.PLAYERS, 0.6F, 0.8F);
    			if(!playerIn.isCreative())
    			{
    				FluidStack fluid = FluidUtil.getFluidHandler(heldItem).drain(1000, true);
    			}
    			return true;
    
    		}

     

×
×
  • Create New...

Important Information

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