-
Posts
408 -
Joined
-
Last visited
Everything posted by winnetrie
-
Custom resources not working in modding environment only
winnetrie replied to winnetrie's topic in Modder Support
Really noone can help me with this? -
Custom resources not working in modding environment only
winnetrie replied to winnetrie's topic in Modder Support
I have added a very recent log file. I hope this helps. I can't find anything related to this issue. Keep in my mind that everything works fine in a real environment. I hope anyone can help me with this, because i never know for 100% ,while in the modding environment(eclipse), that it will work. fml-client-latest.log -
Custom resources not working in modding environment only
winnetrie replied to winnetrie's topic in Modder Support
How can i solve this? Anyone can help? -
Hello, in my mod i made a custom model for ladder and bookshelf. Since i updated to forge 2282 it appears not working anymore. It had worked before and it seems like minecraft is ignoring the resources. The weird thing is that in a real environment it all works fine. So i'm wondering why it doesn't work in the modding environment? I remembered that i had this before once but can't remember how i fixed it. Some more info: I made ladders and bookshelves for all other woodtypes with my model and those are working fine in both modding and real environment. I needed to make also a resource folder for minecraft to apply this also for the standard ladder and bookshelf. The folder is assets/minecraft/blockstates/ladder.json for the blockstate to override (this should override minecrafts ladder with mine, if i'm right) i also have assets/tem/blockstated/jungleladder.json for my jungleladder
-
Aha it seems to work now. Now you mentioned it, event.getState() makes indeed more sense then world.getBlockState(pos) Thank you alot for helping me!
-
I want to drop cherries from the biomesoplenty mods cherry trees. I have not made the cherries right now, so i use a cheese slive instead, just to test the code. So BlockBOPLeaves is not my class and i don't think it's interfering with the events. I also have no other harvestdropsevents. Ofc i know how to define that in my own blocks. That's the whole point. It isn't MY block. That's why i need that event. I did say it already multiple times, but here i go again: The code works fine when those leaves decay, dropping the defined item! If the player breaks the block, for some reason it returns always an airblock.
-
Weird it says it is AIR. Why is that? If it decays it's the right block but if the player breaks it, it is an air block...
-
Ok the code is fine now i guess, but now i have to come back to my main problem i had at start. Nothing drops when the leaves get broken by player hand. Only from decaying it drops. For some reason that if statement that checks wich block it is never turns true when broken by the player. This is what i have now: public class BOPEventHandlerOverride { @SubscribeEvent public void ExtraBOPdrops(HarvestDropsEvent event){ System.out.println("event has occured"); World world = event.getWorld(); BlockPos pos = event.getPos(); int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); IBlockState blockstate = world.getBlockState(pos); Block block = blockstate.getBlock(); if (block == BOPBlocks.leaves_2 &&(blockstate.getValue(((BlockBOPLeaves)BOPBlocks.leaves_2).variantProperty)== BOPTrees.PINK_CHERRY)){ System.out.println("if statement occured"); int random = randomWithRange(0,2); if (random == 1){ System.out.println("random is: "+random); System.out.println("it can drop"); ItemStack stack = new ItemStack(ModItems.cheeseraw); EntityItem item = new EntityItem(world, x,y,z,stack); world.spawnEntityInWorld(item); } } } public static int randomWithRange(int min, int max){ Random rand= new Random(); int randomNum = rand.nextInt((max-min)+1)+min; return randomNum; } } So what's the problem then?
-
In the BlockBOPLeaves.class here: public static VariantPagingHelper<BlockBOPLeaves, BOPTrees> paging = new VariantPagingHelper<BlockBOPLeaves, BOPTrees>(4, BOPTrees.class); // Slightly naughty hackery here // The constructor of Block() calls createBlockState() which needs to know the particular instance's variant property // There is no way to set the individual block instance's variant property before this, because the super() has to be first // So, we use the static variable currentVariantProperty to provide each instance access to its variant property during creation private static IProperty currentVariantProperty; // Create an instance for each page public static void createAllPages() { int numPages = paging.getNumPages(); for (int i = 0; i < numPages; ++i) { currentVariantProperty = paging.getVariantProperty(i); paging.addBlock(i, new BlockBOPLeaves()); } } // Each instance has a reference to its own variant property public IProperty variantProperty; @Override protected BlockStateContainer createBlockState() { this.variantProperty = currentVariantProperty; // get from static variable return new BlockStateContainer(this, new IProperty[] { CHECK_DECAY, DECAYABLE, this.variantProperty }); }
-
That doesn't work either. Getting this error: variantProperty cannot be resolved or is not a field
-
I also don't get this getValue thing working. I have it now like this: public class BOPEventHandlerOverride { @SubscribeEvent public void ExtraBOPdrops(HarvestDropsEvent event){ System.out.println("event has occured"); World world = event.getWorld(); BlockPos pos = event.getPos(); int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); IBlockState blockstate = world.getBlockState(pos); Block block = blockstate.getBlock(); if (block == BOPBlocks.leaves_2 &&( blockstate.getValue(BlockBOPLeaves.variantProperty)==BOPTrees.PINK_CHERRY)){ System.out.println("if statement occured"); int random = randomWithRange(0,2); if (random == 1){ System.out.println("random is: "+random); System.out.println("it can drop"); ItemStack stack = new ItemStack(ModItems.cheeseraw); EntityItem item = new EntityItem(world, x,y,z,stack); world.spawnEntityInWorld(item); } } } public static int randomWithRange(int min, int max){ Random rand= new Random(); int randomNum = rand.nextInt((max-min)+1)+min; return randomNum; } } i get this error: Cannot make a static reference to the non-static field BlockBOPLeaves.variantProperty If i change it into this : BlockBOPLeaves.this.variantProperty i get this error: No enclosing instance of the type BlockBOPLeaves is accessible in scope
-
I already posted it. Only difference is HarvestDropsEvent instead BreakEvent. I also explained that in the first post too
-
Why isn't it dropping for me with harvestdropsevent? it does drop from decay but not from playerbreaking. Why is that?
-
If i want something to drop from treeleaves for example cherries, what event(s) do i use best? I tried the harvestdropsevent wich results in only dropping it when the leaves decay but not from breaking it! I tried the breakevent wich results in only dropping it when you actual break it and besides that it also drops in creative mode. My guess is i need to use both and avoid dropping it in creative mode. This is what i have for now: public class BOPEventHandlerOverride { @SubscribeEvent public void ExtraBOPdrops(BreakEvent event){ System.out.println("event has occured"); World world = event.getWorld(); BlockPos pos = event.getPos(); int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); IBlockState blockstate = world.getBlockState(pos); Block block = blockstate.getBlock(); if (block == BOPBlocks.leaves_2 && (block.getMetaFromState(blockstate)==9 || block.getMetaFromState(blockstate)==10) ){ int random = randomWithRange(0,10); if (random == 1){ ItemStack stack = new ItemStack(ModItems.cheeseraw); EntityItem item = new EntityItem(world, x,y,z,stack); world.spawnEntityInWorld(item); } } } public static int randomWithRange(int min, int max){ Random rand= new Random(); int randomNum = rand.nextInt((max-min)+1)+min; return randomNum; } }
-
I already contacted them, because it isn't working. Shale should be only mineable with diamond pickaxe but i can mine it with wooden pickaxe. So i can state the code in the bop class doesn't work. It also doesn't work for me and i do not know why. Yet if i remove the third argument( the state argument) , it is working fine.
-
I am adding support for biomes o plenty in my mod currently and i discovered that this isn't doing anything. At least it looks like it. Because i am making slabs and stairs for the biomesoplenty stones i need them to behave exactly the same. There is a harvestlevel set for limestone, siltstone and shale but they do not work. So i tried this on my blocks too but it doesn't work either! This is what i have set public BlockBOPStonesBlockSlab1(String unlocalname, String registryname) { super(Material.ROCK); setUnlocalizedName(unlocalname); setRegistryName(registryname); useNeighborBrightness = true; setHardness(3.0F); setResistance(5.0F); setSoundType(SoundType.STONE); setCreativeTab(Tem.slabstab); IBlockState state = this.blockState.getBaseState(); //state.withProperty(VARIANT, false); state.withProperty(TYPE, EnumType.LIMESTONE); if(!this.isDouble()){ state.withProperty(HALF, EnumBlockHalf.BOTTOM); } setDefaultState(state); this.setHarvestLevel("pickaxe", 1, this.blockState.getBaseState().withProperty(TYPE, EnumType.LIMESTONE)); this.setHarvestLevel("pickaxe", 2, this.blockState.getBaseState().withProperty(TYPE, EnumType.SILTSTONE)); this.setHarvestLevel("pickaxe", 3, this.blockState.getBaseState().withProperty(TYPE, EnumType.SHALE)); // TODO Auto-generated constructor stub } And this is how it looks in biomesoplenty's class: public BlockBOPStone() { super(Material.ROCK); // set some defaults this.setSoundType(SoundType.STONE); this.setHarvestLevel("pickaxe", 1, this.getDefaultState().withProperty(VARIANT, StoneType.LIMESTONE)); this.setHarvestLevel("pickaxe", 2, this.getDefaultState().withProperty(VARIANT, StoneType.SILTSTONE)); this.setHarvestLevel("pickaxe", 3, this.getDefaultState().withProperty(VARIANT, StoneType.SHALE)); this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, StoneType.LIMESTONE).withProperty(POLISHED, Boolean.valueOf(false)) ); } In my opinion the bop version is wrong. There he calls getDefaultState before it has been set. Even if you switch it, i think it's still wrong and he should use getBaseState. Because a default state has already a property set and then you give it another property. I can be wrong too afcourse... Anyone setharvestlevel doesn't work for me.
-
Do you mean stacksize number, because slots number doesn't make sense for me. If i understand it right, i think you want to do something similar as terrafirmacraft? Food for example cannot be stacked but has a weight instead. Maybe there is an event you can call to set the max stacksize of all items to 1. Not sure if this is even posseble. If you make your own items you can use setMaxStackSize(1)
-
Hello, I have created a custom ladder model so it doesn't look like a sheet of paper floating against the wall. The model works fine and looks fine in game too, np with that. The problem i have is that i can't get it some json stuff working with the new forge format. I want to integrate this: { "parent": "item/generated", "textures": { "layer0": "tem:blocks/acacia_wood_ladder" } } wich is my item model for the inventory It has to be integrated into the blockstate json here: { "forge_marker": 1, "defaults": { "textures": { "all": "tem:blocks/acacia_wood_ladder", "particle": "tem:blocks/acacia_wood_ladder" }, "model": "tem:laddermodel" }, "variants": { "facing=north": { "model": "tem:laddermodel", "y": 0 }, "facing=east": { "model": "tem:laddermodel", "y": 90 }, "facing=south": { "model": "tem:laddermodel", "y": 180 }, "facing=west": { "model": "tem:laddermodel", "y": 270 }, "normal": { "model": "tem:laddermodel" } } } I tried a few things but it doesn't work. Everything is working correctly when i separate the inventory model from the blockstate file. Ofc i want this to be in 1 file, like i did with all my other blocks too.
-
I added a cast to it because eclipse tells me do to so. If i don't it it marked as "wrong". i now changed my code to this: @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { Block block = state.getBlock(); int meta = block.getMetaFromState(state); return new ItemStack(block,1,meta); } Strange i haven't seent his before but this looks a lot better now. I also decided to get the meta from the state. Perhaps it makes more sense.
-
jup fixed it now: @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { Block block = world.getBlockState(pos).getBlock(); int meta = ((Enum<EnumType>) world.getBlockState(pos).getValue(TYPE)).ordinal(); return new ItemStack(block,1,meta); } This method comes standard with return getItem(world, pos, state) But that's deprecated and doesn't work in this case. So i came with this idea. What you think? Good or bad? It's working.
-
I created bookshelfs for the other woodtypes. I have 1 problem! When i break them they return 3 books wich is normal and that's also what i want them to do. So that's fine! Yet they do drop as a book with metedata. You see them ingame as huge black/pink cubes. How can i prevent this? Here is the code : this is the methis that return the metadata for the drop. Removing this from the class solves it, but then in creative mode you don't get the right block if you click with the middlemouse button. @Override public int damageDropped(IBlockState state) { return getMetaFromState(state); }
-
I don't think this is completely true. The dot between separates it. If i go look with the explorer those folders are there. Eclipse keeps it together like this because those folders are empty. As soon as you put 1 file or a subfolder in it it will split. I created the folders now by hand in the explorer but it still looks the same as before in eclipse, yet it works now.
-
I just deleted everything and then created it all new and it works now. I have created the folders now in the explorer and not in eclipse, maybe that causes this.
-
Weird! Why doesn't it for me? here a picture:
-
If i have in my mod this: assets\minecraft\textures\gui\container\crafting_table.png assets\minecraft\textures\gui\container\inventory.png should this not replace the minecraft textures? It doesn'r replace it at all and no errors. I thought a mod functions also as a resource pack