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

kwpugh

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by kwpugh

  1. Hi, In 1.12.2, I was using AxisAlignedBB for working with collision boxes on my glass. Should I be using VoxelShapes in 1.14.3? If yes, are there any documents on the basics of VoxelShapes? I have been looking through the reference source and I am not really understanding it. Question: I presume that instances of GlassBlock have a solid collision box? I'm trying to make that conditional, depending on the entity type colliding with it? How does one remove the collision box on a block? Thank you in advance. Regards.
  2. I'm going to add custom methods that allow players to walk through but no mobs. Also, a higher tier of the glass with prohibit spider climbing and be wither proof. I kept my post simple because the basics were not working the way they did in my 1.12.2 code. I found the problem, I was not calling the correct "new BlockGobberGlass" .
  3. Now on 1.14.3. Can't seem to change the title of the topic.
  4. Hi All, I'm trying to create a custom glass block. Here is the basic code: package com.kwpugh.gobber2.blocks; import net.minecraft.block.GlassBlock; public class BlockGobberGlass extends GlassBlock { public BlockGobberGlass(Properties properties) { super(properties); } } I thought that creating a block that extends GlassBlock would give my glass block all of the properties of its parent and above, such as being transparent, which it is not. The sides are black. In Game Result Any thoughts on what I'm doing wrong here? Regards.
  5. In digging around in the Minecraft references, I was able to figure out that the IGrowable interface controls the crops and saplings. I was able to adapt my existing 1.12.2 code to work. However, the effect is instant, which is not exactly what I want. package com.kwpugh.gobber2.items.rings; import java.util.List; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.IGrowable; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; public class ItemCustomRingFarmer extends Item { public ItemCustomRingFarmer(Properties properties) { super(properties); } public void inventoryTick(ItemStack stack, World world, Entity entity, int par4, boolean par5) { if(!(entity instanceof PlayerEntity) || world.isRemote) { return; } PlayerEntity player = (PlayerEntity)entity; ItemStack equipped = player.getHeldItemMainhand(); if(stack == equipped) { int range = 7; for(int x = -range; x < range+1; x++) { for(int z = -range; z < range+1; z++) { for(int y = -range; y < range+1; y++) { int theX = MathHelper.floor(player.posX+x); int theY = MathHelper.floor(player.posY+y); int theZ = MathHelper.floor(player.posZ+z); BlockPos posInQuestion = new BlockPos(theX, theY, theZ); BlockState blockstate = world.getBlockState(posInQuestion); if ((blockstate.getBlock() instanceof IGrowable)) { IGrowable igrowable = (IGrowable)blockstate.getBlock(); if((igrowable == Blocks.GRASS_BLOCK) || (igrowable == Blocks.TALL_GRASS) || (igrowable == Blocks.GRASS) || (igrowable == Blocks.SUNFLOWER) || (igrowable == Blocks.LILAC) || (igrowable == Blocks.ROSE_BUSH) || (igrowable == Blocks.PEONY) || (igrowable == Blocks.SEAGRASS) || (igrowable == Blocks.TALL_SEAGRASS)) { continue; } if (igrowable.canGrow(world, posInQuestion, blockstate, world.isRemote)) { { if (!world.isRemote) { igrowable.grow(world, world.rand, posInQuestion, blockstate); } } } } } } } } } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent("Works on: wheat, beetroot, carrot, potato, and tree saplings")); list.add(new StringTextComponent("Range: 14 blocks")); list.add(new StringTextComponent("Still a bit of a WIP")); } } Oddly, the Sunflower, Lilac, Rose Buse, and Peony will constantly drop their ItemStack if I don't exclude them. Can anyone provide some suggestions for writing a safe and proper timing method that can add a delay in the process? I have seen reference to COOLDOWN in some of the minecraft references, is that a built-in method for that purpose? Any guidance would be greatly appreciated. Thank you and kind regards.
  6. Hi All, Looking for some guidance. What is supposed to happen when two mods override the same /minecraft/loot_tables/xxxxxx.json? Two mods are overriding oak_leaves.json (for example) to add their modded Shears into it. In testing, it seems like neither are used as a result. Looking for some info on how that works. Thank you. Regards.
  7. If I'm looking at this right, it seem that the places updateTick was called from by vanilla have been replaced with animateTick, which does not work for accelerating block state transitions (not sure if I said that right). Basically, I want to be able to accelerate the ticks received by IGrowables in a defined block distance while my item is held in the main hand. Any suggestions?
  8. Hi All, I'm looking for some guidance here. I'm trying to spawn my ore in the End. Here is how I did it in the the Overworld and Nether: public static void setupOregen() { for(Biome biome : ForgeRegistries.BIOMES) { if(WorldgenConfig.GOBBER2_ORE_GENERATION.get()) biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(NATURAL_STONE, BlockList.gobber2_ore.getDefaultState(), WorldgenConfig.GOBBER2_ORE_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_MAX_HEIGHT.get()))); if(WorldgenConfig.GOBBER2_LUCKY_BLOCK_GENERATION.get()) biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(NATURAL_STONE, BlockList.gobber2_lucky_block.getDefaultState(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_LUCKY_BLOCK_CHANCE.get(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_LUCKY_BLOCK_MAX_HEIGHT.get()))); } } public static void setupNetherOregen() { if(WorldgenConfig.GOBBER2_ORE_NETHER_GENERATION.get()) Biomes.NETHER.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NETHERRACK, BlockList.gobber2_ore_nether.getDefaultState(), WorldgenConfig.GOBBER2_ORE_NETHER_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_NETHER_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_NETHER_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_NETHER_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_NETHER_MAX_HEIGHT.get()))); } When I change the biome to End biomes, I get nothing. public static void setupEndOregen() { if(WorldgenConfig.GOBBER2_ORE_END_GENERATION.get()) Biomes.THE_END.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, BlockList.gobber2_ore_end.getDefaultState(), WorldgenConfig.GOBBER2_ORE_END_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(WorldgenConfig.GOBBER2_ORE_END_CHANCE.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MIN_HEIGHT.get(), WorldgenConfig.GOBBER2_ORE_END_MAX_HEIGHT.get()))); } No ores spawning as a result. I suspect it is because of the filler block (NATURAL_STONE). I had to change the FillerBlockType to NETHERRACK for it to work in the Nether. Looking through FillerBlockType, there doesn't seem to be any End related blocks. public static enum FillerBlockType { NATURAL_STONE("natural_stone", (p_214739_0_) -> { if (p_214739_0_ == null) { return false; } else { Block block = p_214739_0_.getBlock(); return block == Blocks.STONE || block == Blocks.GRANITE || block == Blocks.DIORITE || block == Blocks.ANDESITE; } }), NETHERRACK("netherrack", new BlockMatcher(Blocks.NETHERRACK)); Any suggestions on how to approach this? Thank you.
  9. Not sure, but is this what you mean by finding usages?
  10. Hi All, I'm looking for guidance. I'm converting an item that ticks crops when held in main hand. I had used the tick method in the Block.class. Since it has been deprecated: @Deprecated public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { } Where should I be looking? Thank you.
  11. So, this seems to work. Is this a proper way to do it? package com.kwpugh.gobber2.items.armor; import com.kwpugh.gobber2.lists.ItemList; import com.kwpugh.gobber2.util.SpecialAbilities; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ArmorItem; import net.minecraft.item.IArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraft.potion.Effects; import net.minecraft.world.World; import net.minecraftforge.registries.ForgeRegistries; public class ItemCustomArmor extends ArmorItem { public ItemCustomArmor(IArmorMaterial materialIn, EquipmentSlotType slots, Properties builder) { super(materialIn, slots, builder); } public void onArmorTick(final ItemStack stack, final World world, final PlayerEntity player) { if(player instanceof PlayerEntity) { ItemStack head = player.getItemStackFromSlot(EquipmentSlotType.HEAD); ItemStack chest = player.getItemStackFromSlot(EquipmentSlotType.CHEST); ItemStack legs = player.getItemStackFromSlot(EquipmentSlotType.LEGS); ItemStack feet = player.getItemStackFromSlot(EquipmentSlotType.FEET); //Full Set if(head.getItem() == ItemList.gobber2_helmet && chest.getItem() == ItemList.gobber2_chestplate && legs.getItem() == ItemList.gobber2_leggings && feet.getItem() == ItemList.gobber2_boots) { ((LivingEntity) ForgeRegistries.POTIONS).removePotionEffect(Effects.POISON); } //Helmet if(head.getItem() == ItemList.gobber2_helmet) { int newfoodlevel = 1; float newsatlevel = 0.0F; SpecialAbilities.giveRegenffect(world, player, stack, newfoodlevel, newsatlevel); } //Chestplate if(chest.getItem() == ItemList.gobber2_chestplate) { if(player.isInWater()) { SpecialAbilities.giveBreathing(world, player, chest); } } //Leggings if(legs.getItem() == ItemList.gobber2_leggings) { player.fallDistance = 0.0F; } //Boots if(feet.getItem() == ItemList.gobber2_boots) { player.stepHeight = 2.1F; if(!player.onGround) { //player.jumpMovementFactor += 0.09F; } } } } public void inventoryTick(ItemStack stack, World world, PlayerEntity player, int itemSlot, boolean isSelected) { ItemStack head = player.getItemStackFromSlot(EquipmentSlotType.HEAD); ItemStack chest = player.getItemStackFromSlot(EquipmentSlotType.CHEST); ItemStack legs = player.getItemStackFromSlot(EquipmentSlotType.LEGS); ItemStack feet = player.getItemStackFromSlot(EquipmentSlotType.FEET); if(!(legs.getItem() == ItemList.gobber2_leggings)) { player.fallDistance = 1.0F; } if(!(feet.getItem() == ItemList.gobber2_boots)) { player.stepHeight = 0.0F; } } @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return true; } @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == ItemList.gobber2_armor_repair; } }
  12. ok, I should use inventroyTick to remove? From an educational perspective, why do potion effects stop when the armor piece is removed, but no step height?
  13. Hi All, I'm having some trouble with an armor class. When the player remove the boots, the change in step height does not go away. Is there a different way I should be implementing this or am I missing something important? Any guidance would help. Thank you. package com.kwpugh.gobber2.items.armor; import com.kwpugh.gobber2.lists.ItemList; import com.kwpugh.gobber2.util.SpecialAbilities; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ArmorItem; import net.minecraft.item.IArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraft.potion.Effect; import net.minecraft.world.World; public class ItemCustomArmor extends ArmorItem { public ItemCustomArmor(IArmorMaterial materialIn, EquipmentSlotType slots, Properties builder) { super(materialIn, slots, builder); } public void onArmorTick(final ItemStack stack, final World world, final PlayerEntity player) { if(player instanceof PlayerEntity) { ItemStack head = player.getItemStackFromSlot(EquipmentSlotType.HEAD); ItemStack chest = player.getItemStackFromSlot(EquipmentSlotType.CHEST); ItemStack legs = player.getItemStackFromSlot(EquipmentSlotType.LEGS); ItemStack feet = player.getItemStackFromSlot(EquipmentSlotType.FEET); //Full Set if(head != null && head.getItem() == ItemList.gobber2_helmet && chest != null && chest.getItem() == ItemList.gobber2_chestplate && legs != null && legs.getItem() == ItemList.gobber2_leggings && feet != null && feet.getItem() == ItemList.gobber2_boots) { ((LivingEntity) player).removePotionEffect(Effect.get(19)); //Poison } //Helmet if(head.getItem() == ItemList.gobber2_helmet) { int newfoodlevel = 1; float newsatlevel = 0.0F; SpecialAbilities.giveRegenffect(world, player, stack, newfoodlevel, newsatlevel); } else { } //Chestplate if(chest.getItem() == ItemList.gobber2_chestplate) { if(player.isInWater()) { SpecialAbilities.giveBreathing(world, player, chest); } } //Leggings if(legs.getItem() == ItemList.gobber2_leggings) { player.fallDistance = 0.0F; } else { player.fallDistance = 1.0F; } //Boots if(feet.getItem() == ItemList.gobber2_boots) { player.stepHeight = 2.1F; if(!player.onGround) { //player.jumpMovementFactor += 0.09F; } } else { player.stepHeight = 0.0F; } } } @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return true; } @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == ItemList.gobber2_armor_repair; } }
  14. Thanks for the pointer. I adapted some code there and added a static methods for field_220115_d. Thanks for the help. player.openContainer(new SimpleNamedContainerProvider((p_220114_1_, p_220114_2_, p_220114_3_) -> { return ChestContainer.createGeneric9X3(p_220114_1_, p_220114_2_, enderChest); }, field_220115_d));
  15. Hi All, I'm looking for some guidance here. I'm converting my mod from 1.12.2 --> 1.14.3 and have a question. I have an item that allows a player to open their EnderChest by right-clicking an item. The .openGUIChest doesn't exist in PlayerEntity in 1.14.3, and throws an error. Reading through PlayerEntity.java yields no insight, so I'm stuck. Suggestions? Here is my code: package com.kwpugh.gobber2.items.rings; import java.util.List; import com.kwpugh.gobber2.util.RayTraceUtil; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.EnderChestInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; public class ItemCustomRingEnderman extends Item { public ItemCustomRingEnderman(Properties properties) { super(properties); } public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) { EnderChestInventory enderChest = player.getInventoryEnderChest(); if (enderChest != null) { if (!world.isRemote) { player.displayGUIChest(enderChest); //player.addStat(StatList.ENDERCHEST_OPENED); } } return new ActionResult<ItemStack>(ActionResultType.PASS, player.getHeldItem(hand)); } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent("Provides player with a boost of speed")); list.add(new StringTextComponent("Right-click to use")); } }
  16. I misunderstood what that method was doing. Removing that methods fixes the problem. Thank you.
  17. Hi All, I'm looking for some guidance. I have custom tools that are picking up inappropriate enchantments in a vanilla enchant table (e.g. Sword that gets Feather Falling II) Here is what my sword class looks like: package com.kwpugh.gobber2.items.tools; import java.util.List; import com.kwpugh.gobber2.lists.ItemList; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.IItemTier; import net.minecraft.item.ItemStack; import net.minecraft.item.SwordItem; import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Effects; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; public class ItemCustomSword extends SwordItem { public ItemCustomSword(IItemTier tier, int attackDamageIn, float attackSpeedIn, Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { if (!worldIn.isRemote) { playerIn.addPotionEffect(new EffectInstance(Effects.STRENGTH, (int) 2400, (int) 2)); } return new ActionResult<ItemStack>(ActionResultType.PASS, playerIn.getHeldItem(handIn)); } @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return true; } @Override public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { return true; } @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == ItemList.gobber2_ingot; } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent("Right-click for extra strength")); } } I didn't see anything in the vanilla SwordItem class that would control this behavior. Could I get some guidance on how to control this. P.S. My custom armor exhibits the same behavior. Regards.
  18. Hi, I'm porting my mod to 1.14.2, and I have an item that clears negative potion effects. This works: entity.removePotionEffect(Effect.get(2)); //Slowness entity.removePotionEffect(Effect.get(4)); //Mining Fatigue entity.removePotionEffect(Effect.get(7)); //Instant Damage entity.removePotionEffect(Effect.get(9)); //Nausea entity.removePotionEffect(Effect.get(15)); //Blindness entity.removePotionEffect(Effect.get(17)); //Hunger I read in a post somewhere that this is bad form, because the ID numbers can change. If have my items that give potion effects using them by name, such as: player.addPotionEffect(new EffectInstance(Effects.NIGHT_VISION, (int) 2400, (int) 0)); I cannot find where in the sources to form a remove potion effect by name however. Thank you in advance. Regards
  19. Hi, I'm looking for some guidance on how best to describe what Forge is and its relationship to Minecraft. I have been asked to give a "Ted Talk" style presentation at work about how I ( a non-programmer by profession, I work in HR) learned to program (still learning) in Java. The angle of the talk will be "How I learned Java by playing Minecraft" or something like that. The point of the talk is to encourage non-programmers in the audience that anyone can get into programming, if you find the right motivation. There will also be people from our technology divisions in the audience, so when I describe Forge, I don't what to be talking out my "behind" and look uninformed. I'm looking for simple and technically accurate. I also expect to get the question: "How does Forge do that, isn't that illegal? Aren't they hacking Minecraft?" So a straightforward answer to that would be help. Thank you in advance and regards.
  20. Hi Thank you for taking the time to make a thoughtful and very clear post to my questions. I now understand the properties much better than before. Have a great weekend. Regards
  21. Last question related to food (hopefully). I have a food that is a stew. How best to give the bowl back after eating? In my 1.12.2 mod, I had a class for each stew that extended ItemFood and gave the player a bowl in the onFoodEaten method. Is there a better way with 1.14.2?
  22. [SOLVED] Turns out the order of the properties matter. I moved the .food property to the front and it works. ItemList.gobber2_goo = new Item(new Item.Properties().food(FoodList.gooFood).group(gobber2)).setRegistryName(location("gobber2_goo")), Thank you for all the guidance.
×
×
  • Create New...

Important Information

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