Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

PegBeard

Members
  • Posts

    59
  • Joined

  • Last visited

Posts posted by PegBeard

  1. I have a dispenser behaviour class, which is registered in the postInit:

     

    Spoiler
    
    public class DTDispensePowderKeg extends BehaviorDefaultDispenseItem
    {
        @Override
    	protected ItemStack dispenseStack(IBlockSource source, ItemStack stack)
        {
            World world = source.getWorld();
            BlockPos pos = source.getBlockPos();
            world.playSound((EntityPlayer)null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
            stack.shrink(1);
            world.removeTileEntity(pos);
            world.isAirBlock(pos);
            world.newExplosion((EntityPlayer)null, pos.getX()+0.5D, pos.getY()+0.5D, pos.getZ()+0.5D, 4.0F, true, true);
            return stack;
        }
    }

     

    Is this correct? I looked it up back in 1.8, and assumed this was still relevant, as my other dispenser behaviours still work.

  2. I was messing around with dispenser behaviour and found that if the dispenser is replaced/destroyed/otherwise removed while dispensing, the game crashes with this in the log:

    Spoiler

    PM
    Description: Exception while ticking a block

    java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[down, up, north, south, west, east]} as it does not exist in BlockStateContainer{block=minecraft:air, properties=[]}
        at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:204)
        at net.minecraft.dispenser.BehaviorDefaultDispenseItem.dispense(BehaviorDefaultDispenseItem.java:18)
        at net.minecraft.block.BlockDispenser.dispense(BlockDispenser.java:153)
        at net.minecraft.block.BlockDispenser.updateTick(BlockDispenser.java:189)
        at net.minecraft.world.WorldServer.tickUpdates(WorldServer.java:774)
        at net.minecraft.world.WorldServer.tick(WorldServer.java:231)
        at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:825)
        at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:740)
        at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:589)
        at java.lang.Thread.run(Thread.java:748)


    What happened to cause this is pretty simple - I made the dispensed stack cause an explosion, however, I get the same result if I set the dispenser to a different block (air, for example).
    I have tried removing the tile entity before setting the block to air and/or causing the explosion, but the result is the same.

    Is there any way I can prevent this crash, other than delaying the explosion?

  3. Since up dating to 1.12; while loading a world (new or old) , I get an issue where the game begins loading the world but freezes on the dirt screen, displaying '0%'. The next time I go to load that same world, player data has been reset, as if joining the world for the first time. Checking world files, the player data is still there, but a new file has been made for the effected player.

    Because the game does not actually crash, I don't have a lot to go on for what is causing this, but last time it happened I did manage to spot this in the log:

    [19:08:14] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : minecraft@1.12,FML@8.0.99.99,forge@14.21.1.2406,dungeontactics@DT-0.12.7,mcp@9.19
    [19:08:14] [Netty Local Client IO #0/ERROR] [FML]: HandshakeMessageHandler exception
    java.lang.ClassCastException: net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage$ServerHello cannot be cast to net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage$ModList
    	at net.minecraftforge.fml.common.network.handshake.FMLHandshakeClientState$3.accept(FMLHandshakeClientState.java:99) ~[FMLHandshakeClientState$3.class:?]
    	at net.minecraftforge.fml.common.network.handshake.FMLHandshakeClientState$3.accept(FMLHandshakeClientState.java:94) ~[FMLHandshakeClientState$3.class:?]
    	at net.minecraftforge.fml.common.network.handshake.HandshakeMessageHandler.channelRead0(HandshakeMessageHandler.java:48) ~[HandshakeMessageHandler.class:?]
    	at net.minecraftforge.fml.common.network.handshake.HandshakeMessageHandler.channelRead0(HandshakeMessageHandler.java:30) ~[HandshakeMessageHandler.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) ~[SimpleChannelInboundHandler.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) [MessageToMessageDecoder.class:4.1.9.Final]
    	at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) [MessageToMessageCodec.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at net.minecraftforge.fml.common.network.handshake.ChannelRegistrationHandler.channelRead0(ChannelRegistrationHandler.java:55) [ChannelRegistrationHandler.class:?]
    	at net.minecraftforge.fml.common.network.handshake.ChannelRegistrationHandler.channelRead0(ChannelRegistrationHandler.java:38) [ChannelRegistrationHandler.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final]
    	at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:274) [EmbeddedChannel.class:4.1.9.Final]
    	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:390) [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:74) [NetworkDispatcher.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final]
    	at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:443) [LocalChannel.class:4.1.9.Final]
    	at io.netty.channel.local.LocalChannel.access$500(LocalChannel.java:49) [LocalChannel.class:4.1.9.Final]
    	at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:397) [LocalChannel$5.class:4.1.9.Final]
    	at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54) [DefaultEventLoop.class:4.1.9.Final]
    	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final]
    	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
    [19:08:14] [Netty Local Client IO #0/ERROR] [FML]: NetworkDispatcher exception
    java.lang.ClassCastException: net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage$ServerHello cannot be cast to net.minecraftforge.fml.common.network.handshake.FMLHandshakeMessage$ModList
    	at net.minecraftforge.fml.common.network.handshake.FMLHandshakeClientState$3.accept(FMLHandshakeClientState.java:99) ~[FMLHandshakeClientState$3.class:?]
    	at net.minecraftforge.fml.common.network.handshake.FMLHandshakeClientState$3.accept(FMLHandshakeClientState.java:94) ~[FMLHandshakeClientState$3.class:?]
    	at net.minecraftforge.fml.common.network.handshake.HandshakeMessageHandler.channelRead0(HandshakeMessageHandler.java:48) ~[HandshakeMessageHandler.class:?]
    	at net.minecraftforge.fml.common.network.handshake.HandshakeMessageHandler.channelRead0(HandshakeMessageHandler.java:30) ~[HandshakeMessageHandler.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) ~[SimpleChannelInboundHandler.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) ~[MessageToMessageDecoder.class:4.1.9.Final]
    	at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at net.minecraftforge.fml.common.network.handshake.ChannelRegistrationHandler.channelRead0(ChannelRegistrationHandler.java:55) ~[ChannelRegistrationHandler.class:?]
    	at net.minecraftforge.fml.common.network.handshake.ChannelRegistrationHandler.channelRead0(ChannelRegistrationHandler.java:38) ~[ChannelRegistrationHandler.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) ~[SimpleChannelInboundHandler.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) ~[DefaultChannelPipeline$HeadContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) ~[DefaultChannelPipeline.class:4.1.9.Final]
    	at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:274) ~[EmbeddedChannel.class:4.1.9.Final]
    	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleClientSideCustomPacket(NetworkDispatcher.java:390) ~[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:74) ~[NetworkDispatcher.class:?]
    	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) ~[SimpleChannelInboundHandler.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:4.1.9.Final]
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:4.1.9.Final]
    	at io.netty.channel.local.LocalChannel.finishPeerRead0(LocalChannel.java:443) [LocalChannel.class:4.1.9.Final]
    	at io.netty.channel.local.LocalChannel.access$500(LocalChannel.java:49) [LocalChannel.class:4.1.9.Final]
    	at io.netty.channel.local.LocalChannel$5.run(LocalChannel.java:397) [LocalChannel$5.class:4.1.9.Final]
    	at io.netty.channel.DefaultEventLoop.run(DefaultEventLoop.java:54) [DefaultEventLoop.class:4.1.9.Final]
    	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final]
    	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]


    I have tried running my mod with various parts disabled and still get the issue. So I am not sure if it is something to do with my installation, if I have done something improperly, or if it is something with forge.
    Any help would be greatly appreciated.

  4. I recently switched to using the registry event, for my blocks and items. This is working fine, but I noticed that I am getting a 'Dangerous alternative prefix' warning when running my mod with virtually any other mod.
    I'm no expert, but it seems like, when another mod registers items, etc, the event fires and my mod is registering content in the middle of the other mod. I say this because:

    Dangerous alternative prefix `dungeontactics` for name `dungeonpedia`, expected `forestry` invalid registry invocation/invalid name?

    This seems to indicate that forge is expecting, in this case, a registry from forestry, but is getting mine instead.

    I have been told that this is just a warning and I don't need to worry about it, but I was wondering if there is anything I can do about it - preferably prevent what is causing the warning, not just hide it from the log.

  5. This is the first time I have done meta items. Everything works, except the first subitem appears in in the creative inventory 'Delete Item' slot, and at the end of every creative tab.
    For testing purposes, I stripped the class down to the essentials, but the error persists.

     

    	public static ItemStack item1;
        public static ItemStack item2;
    
        public DTTest(String name)
        {
    		this.setUnlocalizedName(Reference.MOD_ID + ":" + name);
    		this.setCreativeTab(DTCreativeTab.DT_TAB);
    		this.setMaxDamage(0);
    		setContainerItem(this);
    		setHasSubtypes(true);
    	    
    		item1 = new ItemStack(this);
    		item1.setItemDamage(0);
            
    		item2 = new ItemStack(this);
    		item2.setItemDamage(1);
        }
    
        @SideOnly(Side.CLIENT)
        @Override
        public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items)
        {
            items.add(item1);
            items.add(item2);
        }

     

    The item is registered thusly, and called during preInit (haven't switched to events yet):

    public static Item test = new DTTest(Names.Items.TEST);
    
    ForgeRegistries.ITEMS.register(test.setRegistryName(Names.Items.TEST));

     

  6. It was identical to the code shown above, but in the  onItemUseFirst method. So I didn't want to over complicate the original post.

     

        @Override
        public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, EnumHand hand)
        {
        	if (hand == EnumHand.OFF_HAND)
        	{
        		return EnumActionResult.FAIL;
        	}
    
        	Block block = world.getBlockState(pos).getBlock();
        	if (!player.canPlayerEdit(pos, facing, player.getHeldItem(hand)))
        	{
        		return EnumActionResult.PASS;
        	}
        	
        	if (block.getValidRotations(world, pos) != null)
        	{
                if (!player.capabilities.isCreativeMode)
                {
                    player.getHeldItem(hand).damageItem(1, player);
                }
                block.rotateBlock(world, pos, facing);
        		SoundType soundtype = block.getSoundType(world.getBlockState(pos), world, pos, player);
                world.playSound(player, pos, soundtype.getHitSound(), SoundCategory.BLOCKS, soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
            	player.swingArm(hand);
            	return EnumActionResult.SUCCESS;
        	}
        	return EnumActionResult.PASS;
        }

    When doing the rotation this way, it appears to rotate, but when the block is updated, it reverts the rotation.

  7. Not meaning to sound rude, but I had figured that much out and it doesn't really answer my question.
    Are you saying that there is no good way to get the rotation to stick when using  onItemUseFirst and no good way to give my item preference with  onItemUse except when sneaking?

     

    I don't mind sticking with  onItemUse and sneaking, I am just curious if there is a way to do what I am asking, for versatility reasons.

  8. I have created a wrench item. When right-clicking a rotatable block, such as a piston, with said wrench, it rotates the block. This works fine but;
    If I rotate the block during 'onItemUse' and the block has an inventory, the inventory is shown - is there a way I can stop that but still rotate the block?
    If I rotate the block during 'onItemUseFirst' no gui is opened but the block resets after a block update - is there a way to make the rotation stick, or is this just the wrong place to do the rotation.

    I have my own rotate code, but for testing purposes I am just using the default method and still getting the results stated above:

        @Override
        public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
        {
        	if (hand == EnumHand.OFF_HAND)
        	{
        		return EnumActionResult.FAIL;
        	}
    
        	Block block = world.getBlockState(pos).getBlock();
        	if (!player.canPlayerEdit(pos, facing, player.getHeldItem(hand)))
        	{
        		return EnumActionResult.PASS;
        	}
        	
        	if (block.getValidRotations(world, pos) != null)
        	{
                if (!player.capabilities.isCreativeMode)
                {
                    player.getHeldItem(hand).damageItem(1, player);
                }
                block.rotateBlock(world, pos, facing);
        		SoundType soundtype = block.getSoundType(world.getBlockState(pos), world, pos, player);
                world.playSound(player, pos, soundtype.getHitSound(), SoundCategory.BLOCKS, soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
            	player.swingArm(hand);
            	return EnumActionResult.SUCCESS;
        	}
        	return EnumActionResult.PASS;
        }

     

  9. I have some extra weapons in my mod, made from common modded resources. The crafting recipes work fine (using the ore dictionary), but I was wondering if the recipe could be unlocked using the ore dictionary.
    As shown below, attempting to use an ore_dict ore in this way grants the recipe when the player picks up any item (not just the specified 'ore').

     

    {
        "parent": "minecraft:recipes/root",
        "rewards": {
            "recipes": [
                "dungeontactics:weapons/extra_materials/steel_knife"
            ]
        },
        "criteria": {
            "has_item": {
                "trigger": "minecraft:inventory_changed",
                "conditions": {
                    "items": [
                        {
                            "type": "forge:ore_dict",
                            "ore": "ingotSteel"
                        }
                    ]
                }
            }
        }
    }

     

    I have also tried changing the "items" (under "conditions") to "types", but this yielded the same result.

    Is it possible to achieve this?

  10. Didn't find anything on the old googles, but I was wondering if we are gonna get an event for when a player triggers an advancement, to replace the achievement event in 1.12?

    Also, would it be possible to differentiate between advancements that do and don't announce to chat/display an on-screen tab?

  11. I know that 52 is java 8, but that's what I have installed. I removed old versions when I updated the jre and jdk, so as far as I can tell, java 8 is the only version I have installed.
    Do I have to change something on my system to make sure gradle is actually using java 8?

  12. I recently updated my JRE and JDK to 8u131 (see attached image). I had no problem with 1.11.2, but when trying to setup the workspace for 1.12 I get an unsupported major.minor version 52.0 error.
    I know this means there is a version discrepancy, but I don't know which version of java I need.

    Untitled.png

  13. I am getting this in the console, on load:


     

    Spoiler

    [Client thread/WARN]: Failed to load texture: dungeontactics:/textures/misc/cryo_effect.png
    java.io.FileNotFoundException: dungeontactics:/textures/misc/cryo_effect.png
        at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?]
        at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
        at net.minecraft.client.renderer.texture.SimpleTexture.loadTexture(SimpleTexture.java:34) ~[SimpleTexture.class:?]
        at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:67) [TextureManager.class:?]
        at net.minecraft.client.renderer.texture.TextureManager.bindTexture(TextureManager.java:42) [TextureManager.class:?]
        at PegBeard.DungeonTactics.Effects.DTCryoEffect.renderHUDEffect(DTCryoEffect.java:57) [DTCryoEffect.class:?]
        at net.minecraft.client.gui.GuiIngame.renderPotionEffects(GuiIngame.java:500) [GuiIngame.class:?]
        at net.minecraftforge.client.GuiIngameForge.renderPotionIcons(GuiIngameForge.java:225) [GuiIngameForge.class:?]
        at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:173) [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(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?: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(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
        at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
        at GradleStart.main(GradleStart.java:26) [start/:?]


    Everything is lowercase and the textures are in the specified location - as I mentioned, everything was working in 1.10, my code hasn't changed and the textures haven't been moved/renamed either

  14. The code I have worked in 1.10.2, so I know everything is labelled properly and the texture is in the right place, but in 1.11.2 the potion icon in the player's inventory and on the HUD renders the missing texture.
    I have looked for any changes, but everything I have found just confirms what I already have.

    This is my current code (nothing flash, just what I got from a tutorial):
     

    Spoiler
    
    public class DTEffectGeneric extends Potion
    {
    	private final ResourceLocation iconTexture;
    	
    	public DTEffectGeneric(boolean isBadEffect, int liquidColor, String name)
    	{
    		super(isBadEffect, liquidColor);
    		this.setPotionName(this, name);
    		iconTexture = new ResourceLocation(Reference.MOD_ID, "/textures/misc/" + name + ".png");
    	}
    
    	public static void setPotionName(Potion potion, String potionName)
    	{
    		potion.setPotionName("effect." + Reference.MOD_ID + ":" + potionName);
    	}
    
    	@SideOnly(Side.CLIENT)
    	@Override
    	public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc)
    	{
    		if (mc.currentScreen != null)
    		{
    			mc.getTextureManager().bindTexture(iconTexture);
    			Gui.drawModalRectWithCustomSizedTexture(x + 6, y + 7, 0, 0, 18, 18, 18, 18);
    		}
    	}
    
    	@SideOnly(Side.CLIENT)
    	@Override
    	public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha)
    	{
    		mc.getTextureManager().bindTexture(iconTexture);
    		Gui.drawModalRectWithCustomSizedTexture(x + 3, y + 3, 0, 0, 18, 18, 18, 18);
    	}
    }

     

    My potion effects are being registered in the PreInit and the effects work properly, and the localised names are correct, so I assume there is something wrong with the resource path, but it worked as it is in 1.10 and I am not sure what changed.
    Any help would be appreciated.

  15. I want to spawn a firework when the player rightclicks with an item. I have looked at the firework item, the firework entity, and the crafting code. Which has gotten me to this point (code below). The problem I am having is that the firework has no effect, just shoots up with a trail then disappears.

     

    ItemStack firework = new ItemStack(Items.FIREWORKS);
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    NBTTagCompound nbttagcompound2 = new NBTTagCompound();
    List<Integer> list = Lists.<Integer>newArrayList();
    list.add(Integer.valueOf(ItemDye.DYE_COLORS[0 & 15]));
    list.add(Integer.valueOf(ItemDye.DYE_COLORS[14 & 15]));
    int[] aint1 = new int[list.size()];
    
    for (int l2 = 0; l2 < aint1.length; ++l2)
    {
    aint1[l2] = ((Integer)list.get(l2)).intValue();
    }
    
    nbttagcompound2.setIntArray("Colors", aint1);
    nbttagcompound2.setBoolean("Flicker", true);
    nbttagcompound1.setTag("Explosion", nbttagcompound2);
    
    firework.setTagCompound(nbttagcompound1);
    EntityFireworkRocket rocket = new EntityFireworkRocket(world, player.posX, player.posY + 0.5F, player.posZ, firework);
    world.spawnEntityInWorld(rocket);
    return new ActionResult(EnumActionResult.SUCESS, stack);

     

    I have tried dropping the item (player.entityDropItem(firework)), which shows that it does have an NBTtag, but the tag doesn't add anything to the items display information, nor does it add an effect to the firework.

    Interestingly, if I change the ItemStack to a firework_charge, the NBTtags do work. They add the info and can be crafted into a regular firework.

     

    Is there a specific method for adding NBT to fireworks, similar to how you add enchantments to books, or am I just doing it wrong?

     

    P.S. I know the code isn't pretty, but I am just trying to brute force it, until I can get it working, then I will do the appropriate checks and conditions.

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.