Everything posted by statphantom
-
[1.8] My First Modding Experience
Video Will be Live shortly.
-
[1.8] Drop item from a vanilla block
if the block already has an item then you can use HarvestDropsEvent. you first add a chance float then add your item. if the block has no drops or you want the item to drop with any tool (such as allowing obsidian to drop from an iron pciaxe) then you can use BreakEvent and spawn the item in the world.
-
Point system
to store your own variables per player you want to create a class that extends IExtendedEntityProperties, but then you will need to create your own graphic GUI overlay by creating a class that extends Gui. I suggest looking up a tutorial on those classes first.
-
[1.7.10] Minecart Break Event?
I am not sure about minecart since it is an Item not a block, I have not yet messed with it but there is a specific event dedicated to minecarts 'MinecartEvent'. sadly I have no idea how to get the destruction or death of it though
-
[1.8] [solved]custom command help
What? No! you're not? that's how I did all of my commands and they work, what's the better way?
-
[1.8] [solved]custom command help
for 1.8 you want to implement ICommand Also I can not see a constructor, should add one with no parameters but inside the constructor add your aliases you want it to allow.
-
Help!
honestly I'm just guessing. but it will add a new model mesh renderer to your item.
-
Help!
maybe you are following an out of date tutorial. try it that way.
-
Help!
the second half of my post....
-
Help!
coaldust = new coaldust().setUnlocalizedName("coaldust").setTextureName("al:coaldust").setCreativeTab(tabAlchimia); add these methods in the constructor instead. you are not registering your textures try this... if (event.getSide() == Side.CLIENT) { regTexture(blockSau); } public void regTexture(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); }
-
Help!
post your code. code helps, always reference code.
-
How to craft with modded items
the letter goes first. 'D', StormMastery.extraction, 'P', Items.potionitem);
-
Help!
you need to register and render the item BEFORE calling the recipe, I do all recipes in init and all item creating, registering, rendering etc in pre-init
-
[1.8] custom tool effectiveness
Ok it seems I can't do this from 'Block.isToolEffective()'. I'll try just doing getStrVsBlock and see if it is > 1.0f
-
[1.8] custom tool effectiveness
a) I can't seem to get 'world' from playerEvent.BreakSpeed so I had to make my own to not need that parameter. b) I'm still a little confused about how the classes calculate this all, it seems pickaxes are a special, other then that it calls the getHarvestTool method on the block and checks if that is ok? or something like that. it is a bit inconsistent and hard to follow but I'm learning my way through it.
-
[1.8] Plantdrops
yes, I was commenting on your code, can be tidied up a bit by doing that. you can manually add code just by using the BB [ code] //your code here [ /code] without the space (I dont know how to escape BB code).
-
[1.8] Plantdrops
you want to put the imports above all your functions such as import java.util.List; import net.minecraft.world.IBlockAccess @Override public void someFunction(theEvent e) { } note, this is only if you create the item class yourself and you want to override the super class.
-
[1.8] custom tool effectiveness
this is the event... @SubscribeEvent public void onPlayerMineEvent(PlayerEvent.BreakSpeed event) { ItemStack helditem = event.entityPlayer.getCurrentEquippedItem(); Block block = event.state.getBlock(); IBlockState blockstate = event.state; event.newSpeed = -1; if (helditem == null) { if (block == Blocks.tallgrass || block == Blocks.double_plant) { event.newSpeed = 1f; } } else if (isEffective(helditem, blockstate)) { if (helditem.getItem() instanceof WoodenRake) { event.newSpeed = event.originalSpeed * 0.2f; } else { event.newSpeed = event.originalSpeed * 0.33f; } } } which calls this method... public boolean isEffective(ItemStack helditem, IBlockState block) { if (helditem.getItem().isItemTool(helditem)) { Set<String> tooltypes = helditem.getItem().getToolClasses(helditem); for (String s : tooltypes) { if (block.getBlock().isToolEffective(s, block)) { return true; } } } return false; } I wan't to (as all programmers should) avoid as many repeats in code as possible, and use this code to make you only able to break blocks with the correct tools only and nothing else (with a few exceptions like tall grass).
-
[1.8] custom tool effectiveness
That isn't exactly what I mean. I wanted this code... if (block.getBlock().isToolEffective(s, block)) { return true; } To work on a custom tooltype string. This I don't think is possible.
-
[1.8] Plantdrops
events is how you change player / world interaction, I think it is the most important part of modding.
-
[1.8] custom tool effectiveness
HOW?! please help! that would be amazing if I can get them to work.
-
[1.8] Plantdrops
try something like this.... @SubscribeEvent public void onHarvestEvent(HarvestDropsEvent event) { if (event.state.getBlock() == Blocks.wheat) { event.drops.clear(); event.drops.add(new ItemStack(Items.wheat_seeds, 1, 1)); } } haven't tested yet but should be close to what you want.
-
[1.8] Plantdrops
ohhh ok I THINK this is what you are after. you want to subscribe to HarvestDropsEvent. then clear the drops, then add the seed back in with the quantity of 1. of cause checking that the block harvested is the correct block you want to change etc etc.
-
[1.8] custom tool effectiveness
I had a look back and it turns out I am asking something that's impossible. I wanted to add a new "ToolType" and add blocks that this tool is effective against. But I think the only way to do this is change vanilla code and no way to do it using forge hooks. Just encase there is please let me know? basically I want my new tool type "rake" and make some blocks effective to "shovel" and "rake" PS: I really think this is impossible with forge hooks only.
-
[1.8] Plantdrops
don't they do that already? wheat drops a wheat seed, carrot drops a carrot seed
IPS spam blocked by CleanTalk.