Jump to content

Zeurkous

Members
  • Posts

    25
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new! Yes I am

Zeurkous's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. This totally works, thanks alot. You're a lifesaver. Generics is something I've been struggling with. Thanks again
  2. I'm sorry man, I'm lost over here. Care to help me out?
  3. This is where my Java knowledge lets me down. I'll try to find a solution to that. In the mean time, I thank you for the help so far.
  4. Right. I'm getting really confused when I'm working with DataTypes I don't understand. So for(Comparable<?> value : prop.getAllowedValues()){ prop.getName(value); } gives me this error on #getName(value): "The method getName(capture#3-of ?) in the type IProperty<capture#3-of ?> is not applicable for the arguments (Comparable<capture#4-of ?>)"
  5. But that gives me thing like 'variant' , 'color', etc.. That part is done. for(IProperty<?> prop : block.getDefaultState().getPropertyNames()){ String propname = prop.getName(); if(propname.equals("variant")){ No?
  6. Yes, but this gives me an error for(IProperty value : prop.getAllowedValues()){} Am I missing something? I feel like I'm doing something very wrong here.
  7. Okay you said "at hand", I read "in hand". My bad. Fixed that. On the other 2 problems however you lost me sorry. I'm iterating over the possible values for(Comparable<?> value : prop.getAllowedValues()){} but then value doesn't have a #getName And if I try for(IProperty value : prop.getAllowedValues()){} It tells me to change the type of value to Comparable<T> (Eclipse does that)
  8. 1. Cause the sign is not in my hand, It's a sign that is placed somewhere that the player then can rightclick. So is there a better way? 2. Alright thanks i'll remove that. 3. Well purely for testing I hardcoded variant. I'm aware that other blocks have other property's (atleast I just found out) 4. if(values instanceof BlockPlanks.EnumType){ } So then how would I compare this to the variant input? Okay so I guess that i'll need a switch to makes sure that the EnumType matches the item? 5. Well but how do I set the block to be the block of that variant (in this case) I'm sorry if I'm being a noob here Don't have alot modding experience
  9. Following what diesieben07 told me I came to this @SubscribeEvent public void onRightClickBlock(RightClickBlock e) { World world = e.getWorld(); if (!world.isRemote) { String name = world.getBlockState(e.getPos()).getBlock().getLocalizedName(); if (name.equals("Sign")) { TileEntitySign sign = (TileEntitySign) world.getTileEntity(e.getPos()); String itemString = sign.signText[0].getUnformattedComponentText().toLowerCase(); String variant = sign.signText[1].getUnformattedComponentText().toLowerCase(); //Important stuff Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("minecraft:" + itemString)); for(IProperty<?> prop : block.getDefaultState().getPropertyNames()){ String propname = prop.getName(); if(propname.equals("variant")){ for(Comparable<?> values : prop.getAllowedValues()){ if(values.equals(variant)){ // So what now ItemStack stack = new ItemStack(); } } } } } } } Basicly what I do here is right click a sign wich says "planks" on the first row and "acacia" on the second. This totally works (thanks for that) but how do I get an item out of this now?
  10. Hey guys, Is there a simple way to give a player an item variant (sort of wood, color of wool, etc...) without the player knowing it's specific ID. In other words: Is there like a method that would accept the standard name (for example Birch Wood Plank) and output that item (or it's ID so I can work with that)?
  11. Works like a charm. Thanks alot
  12. Oh great thanks, this succesfully works on normal potions. But how would I get a splash or lingering potion? Cause PotionTypes doesn't specify that.
  13. Okay, now this PotionUtils.appendEffects(new ItemStack(Items.POTIONITEM), Collections.singleton(potion)); gives an error, wrong argument for method. So how do I make an ItemStack from the PotionType? PotionType potion = PotionType.getPotionTypeForName(potionString); ItemStack itemstack = new ItemStack(potion,1); doesn't work either
  14. That did indeed work. Thanks. But what I get now is a Waterbottle with an effect. What input would I need to send in order to get an actual vanilla potion?
  15. If I would start with a String input (the name of a vanilla potion), how would I end up with an ItemStack of that potion? The input ofcourse is something the player gives and thus can be any potion that exists. Anyone has any idea? I tried this Potion potion = Potion.getPotionFromResourceLocation(potionString); but i can't make an ItemStack with that.
×
×
  • Create New...

Important Information

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