Jump to content

kwpugh

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by kwpugh

  1. Hi. I had to bring in much of the vanilla crossbow code to get that to work. Here is my source: https://github.com/kwpugh/easy_steel/blob/1.15/src/main/java/com/kwpugh/easy_steel/items/steel/SteelCrossbow.java I tweaked a few things to make it more accurate. Good luck.
  2. Thanks everyone, I appreciate the help. I found the ticking function, which does not have a regular name in the mappings I have installed. blockstate.func_227033_a_((ServerWorld) world, targetPos, world.rand); Ojb: the grow() is limited to a few type of growables, so that was only a partial solution. I decided to go with a functions that ticks blockstates as a generalized solution. Thanks for the guidance. Regards
  3. Hello Fellow Modders, I got a cold call from someone representing a new Minetale server using the Minertale API. Telling me I can make money by selling my mod items from shops to players on their server. I told them I was interested in that, since this is a fun hobby, but got me thinking whether the practice is even legal under Mojang's EULA. Anyone know the scoop on this Minetale API? Regards.
  4. Hi All, I'm working on creating a simple Crossbow based upon my mods materials. The problem is that it just keeps cycling through the charge up without ever reaching "loaded" stage. All of the models and textures work, it just the right-click charge up that does not work. Here is how I added the item steel_crossbow package com.kwpugh.easy_steel.init; import com.kwpugh.easy_steel.EasySteel; import com.kwpugh.easy_steel.items.CrackHammer; import com.kwpugh.easy_steel.items.HandShovel; import com.kwpugh.easy_steel.items.SharpFlint; import com.kwpugh.easy_steel.items.bronze.ArmorBronze; import com.kwpugh.easy_steel.items.bronze.BronzeAxe; import com.kwpugh.easy_steel.items.bronze.BronzeHammer; import com.kwpugh.easy_steel.items.bronze.BronzeHoe; import com.kwpugh.easy_steel.items.bronze.BronzePaxel; import com.kwpugh.easy_steel.items.bronze.BronzePickaxe; import com.kwpugh.easy_steel.items.bronze.BronzeShovel; import com.kwpugh.easy_steel.items.bronze.BronzeSword; import com.kwpugh.easy_steel.items.flint.FlintHatchet; import com.kwpugh.easy_steel.items.flint.FlintHoe; import com.kwpugh.easy_steel.items.flint.FlintKnife; import com.kwpugh.easy_steel.items.flint.FlintMattock; import com.kwpugh.easy_steel.items.flint.FlintShovel; import com.kwpugh.easy_steel.items.hardenedsteel.ArmorHardenedSteel; import com.kwpugh.easy_steel.items.hardenedsteel.HardenedSteelAxe; import com.kwpugh.easy_steel.items.hardenedsteel.HardenedSteelHammer; import com.kwpugh.easy_steel.items.hardenedsteel.HardenedSteelHoe; import com.kwpugh.easy_steel.items.hardenedsteel.HardenedSteelPaxel; import com.kwpugh.easy_steel.items.hardenedsteel.HardenedSteelPickaxe; import com.kwpugh.easy_steel.items.hardenedsteel.HardenedSteelShovel; import com.kwpugh.easy_steel.items.hardenedsteel.HardenedSteelSword; import com.kwpugh.easy_steel.items.powders.Carbon; import com.kwpugh.easy_steel.items.steel.ArmorSteel; import com.kwpugh.easy_steel.items.steel.SteelAxe; import com.kwpugh.easy_steel.items.steel.SteelCrossbow; import com.kwpugh.easy_steel.items.steel.SteelHammer; import com.kwpugh.easy_steel.items.steel.SteelHoe; import com.kwpugh.easy_steel.items.steel.SteelPaxel; import com.kwpugh.easy_steel.items.steel.SteelPickaxe; import com.kwpugh.easy_steel.items.steel.SteelShovel; import com.kwpugh.easy_steel.items.steel.SteelSword; import com.kwpugh.easy_steel.items.tungstencarbide.ArmorTungstenCarbide; import com.kwpugh.easy_steel.items.tungstencarbide.TungstenCarbideAxe; import com.kwpugh.easy_steel.items.tungstencarbide.TungstenCarbideHammer; import com.kwpugh.easy_steel.items.tungstencarbide.TungstenCarbideHoe; import com.kwpugh.easy_steel.items.tungstencarbide.TungstenCarbidePaxel; import com.kwpugh.easy_steel.items.tungstencarbide.TungstenCarbidePickaxe; import com.kwpugh.easy_steel.items.tungstencarbide.TungstenCarbideShovel; import com.kwpugh.easy_steel.items.tungstencarbide.TungstenCarbideSword; import com.kwpugh.easy_steel.lists.ArmorMaterialList; import com.kwpugh.easy_steel.lists.BlockList; import com.kwpugh.easy_steel.lists.ItemList; import com.kwpugh.easy_steel.lists.ToolMaterialList; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemTier; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; public class ItemInit { @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( ItemList.sharp_flint = new SharpFlint(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("sharp_flint")), ItemList.hand_shovel = new HandShovel(ItemTier.WOOD, 1, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hand_shovel")), ItemList.flint_mattock = new FlintMattock(ToolMaterialList.flint, 1, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("flint_mattock")), ItemList.flint_shovel = new FlintShovel(ToolMaterialList.flint, 1, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("flint_shovel")), ItemList.flint_hatchet = new FlintHatchet(ToolMaterialList.flint, 5, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("flint_hatchet")), ItemList.flint_knife = new FlintKnife(ToolMaterialList.flint, 3, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("flint_knife")), ItemList.flint_hoe = new FlintHoe(ToolMaterialList.flint, -1.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("flint_hoe")), ItemList.crack_hammer = new CrackHammer(ItemTier.IRON, 1, -3.3f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("crack_hammer")), ItemList.cassiterite_ore = new BlockItem(BlockList.cassiterite_ore, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(BlockList.cassiterite_ore.getRegistryName()), ItemList.bornite_ore = new BlockItem(BlockList.bornite_ore, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(BlockList.bornite_ore.getRegistryName()), ItemList.wolframite_ore = new BlockItem(BlockList.wolframite_ore, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(BlockList.wolframite_ore.getRegistryName()), ItemList.tin_powder = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tin_powder")), ItemList.copper_powder = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("copper_powder")), ItemList.carbon = new Carbon(new Item.Properties().group(EasySteel.easy_steel), "carbon", 600), ItemList.iron_powder = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("iron_powder")), ItemList.gold_powder = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("gold_powder")), ItemList.diamond_powder = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("diamond_powder")), ItemList.emerald_powder = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("emerald_powder")), ItemList.tungsten_powder = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_powder")), ItemList.raw_bronze = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("raw_bronze")), ItemList.raw_steel = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("raw_steel")), ItemList.raw_hardened_steel = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("raw_hardened_steel")), ItemList.raw_tungsten_carbide = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("raw_tungsten_carbide")), ItemList.bronze_ingot = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_ingot")), ItemList.steel_ingot = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_ingot")), ItemList.hardened_steel_ingot = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_ingot")), ItemList.tungsten_carbide_ingot = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_ingot")), ItemList.bronze_block = new BlockItem(BlockList.bronze_block, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(BlockList.bronze_block.getRegistryName()), ItemList.steel_block = new BlockItem(BlockList.steel_block, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(BlockList.steel_block.getRegistryName()), ItemList.hardened_steel_block = new BlockItem(BlockList.hardened_steel_block, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(BlockList.hardened_steel_block.getRegistryName()), ItemList.tungsten_carbide_block = new BlockItem(BlockList.tungsten_carbide_block, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(BlockList.tungsten_carbide_block.getRegistryName()), ItemList.bronze_plate = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_plate")), ItemList.steel_plate = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_plate")), ItemList.hardened_steel_plate = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_plate")), ItemList.tungsten_carbide_plate = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_plate")), ItemList.bronze_rod = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_rod")), ItemList.steel_rod = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_rod")), ItemList.hardened_steel_rod = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_rod")), ItemList.tungsten_carbide_rod = new Item(new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_rod")), ItemList.bronze_sword = new BronzeSword(ToolMaterialList.bronze, 4, -2.3f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_sword")), ItemList.bronze_pickaxe = new BronzePickaxe(ToolMaterialList.bronze, 2, -2.8f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_pickaxe")), ItemList.bronze_axe = new BronzeAxe(ToolMaterialList.bronze, 6, -3.1f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_axe")), ItemList.bronze_shovel = new BronzeShovel(ToolMaterialList.bronze, 2, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_shovel")), ItemList.bronze_hoe = new BronzeHoe(ToolMaterialList.bronze, -1.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_hoe")), ItemList.bronze_hammer = new BronzeHammer(ToolMaterialList.bronze, 6, -3.3f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_hammer")), ItemList.bronze_paxel = new BronzePaxel(6, -3.2f, ToolMaterialList.bronze, null, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("bronze_paxel")), ItemList.steel_sword = new SteelSword(ToolMaterialList.steel, 5, -2.2f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_sword")), ItemList.steel_pickaxe = new SteelPickaxe(ToolMaterialList.steel, 3, -2.7f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_pickaxe")), ItemList.steel_axe = new SteelAxe(ToolMaterialList.steel, 7, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_axe")), ItemList.steel_shovel = new SteelShovel(ToolMaterialList.steel, 3, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_shovel")), ItemList.steel_hoe = new SteelHoe(ToolMaterialList.steel, -0.5f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_hoe")), ItemList.steel_hammer = new SteelHammer(ToolMaterialList.steel, 7, -3.3f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_hammer")), ItemList.steel_paxel = new SteelPaxel(7, -3.2f, ToolMaterialList.steel, null, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("steel_paxel")), ItemList.steel_crossbow = new SteelCrossbow((new Item.Properties()).maxStackSize(1).group(EasySteel.easy_steel).maxDamage(500)).setRegistryName(location("steel_crossbow")), ItemList.hardened_steel_sword = new HardenedSteelSword(ToolMaterialList.hardened_steel, 5, -2.2f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_sword")), ItemList.hardened_steel_pickaxe = new HardenedSteelPickaxe(ToolMaterialList.hardened_steel, 3, -2.2f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_pickaxe")), ItemList.hardened_steel_axe = new HardenedSteelAxe(ToolMaterialList.hardened_steel, 7, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_axe")), ItemList.hardened_steel_shovel = new HardenedSteelShovel(ToolMaterialList.hardened_steel, 3, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_shovel")), ItemList.hardened_steel_hoe = new HardenedSteelHoe(ToolMaterialList.hardened_steel, -0.5f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_hoe")), ItemList.hardened_steel_hammer = new HardenedSteelHammer(ToolMaterialList.hardened_steel, 7, -3.3f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_hammer")), ItemList.hardened_steel_paxel = new HardenedSteelPaxel(7, -3.2f, ToolMaterialList.hardened_steel, null, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("hardened_steel_paxel")), ItemList.tungsten_carbide_sword = new TungstenCarbideSword(ToolMaterialList.tungsten_carbide, 5, -2.2f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_sword")), ItemList.tungsten_carbide_pickaxe = new TungstenCarbidePickaxe(ToolMaterialList.tungsten_carbide, 3, -2.7f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_pickaxe")), ItemList.tungsten_carbide_axe = new TungstenCarbideAxe(ToolMaterialList.tungsten_carbide, 7, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_axe")), ItemList.tungsten_carbide_shovel = new TungstenCarbideShovel(ToolMaterialList.tungsten_carbide, 3, -3.0f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_shovel")), ItemList.tungsten_carbide_hoe = new TungstenCarbideHoe(ToolMaterialList.tungsten_carbide, -0.5f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_hoe")), ItemList.tungsten_carbide_hammer = new TungstenCarbideHammer(ToolMaterialList.tungsten_carbide, 7, -3.3f, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_hammer")), ItemList.tungsten_carbide_paxel = new TungstenCarbidePaxel(7, -3.2f, ToolMaterialList.tungsten_carbide, null, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("tungsten_carbide_paxel")), ItemList.armor_bronze_head = new ArmorBronze(ArmorMaterialList.bronze, EquipmentSlotType.HEAD, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_bronze_head")), ItemList.armor_bronze_body = new ArmorBronze(ArmorMaterialList.bronze, EquipmentSlotType.CHEST, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_bronze_body")), ItemList.armor_bronze_leggings = new ArmorBronze(ArmorMaterialList.bronze, EquipmentSlotType.LEGS, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_bronze_leggings")), ItemList.armor_bronze_boots = new ArmorBronze(ArmorMaterialList.bronze, EquipmentSlotType.FEET, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_bronze_boots")), ItemList.armor_steel_head = new ArmorSteel(ArmorMaterialList.steel, EquipmentSlotType.HEAD, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_steel_head")), ItemList.armor_steel_body = new ArmorSteel(ArmorMaterialList.steel, EquipmentSlotType.CHEST, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_steel_body")), ItemList.armor_steel_leggings = new ArmorSteel(ArmorMaterialList.steel, EquipmentSlotType.LEGS, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_steel_leggings")), ItemList.armor_steel_boots = new ArmorSteel(ArmorMaterialList.steel, EquipmentSlotType.FEET, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_steel_boots")), ItemList.armor_hardened_steel_head = new ArmorHardenedSteel(ArmorMaterialList.hardened_steel, EquipmentSlotType.HEAD, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_hardened_steel_head")), ItemList.armor_hardened_steel_body = new ArmorHardenedSteel(ArmorMaterialList.hardened_steel, EquipmentSlotType.CHEST, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_hardened_steel_body")), ItemList.armor_hardened_steel_leggings = new ArmorHardenedSteel(ArmorMaterialList.hardened_steel, EquipmentSlotType.LEGS, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_hardened_steel_leggings")), ItemList.armor_hardened_steel_boots = new ArmorHardenedSteel(ArmorMaterialList.hardened_steel, EquipmentSlotType.FEET, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_hardened_steel_boots")), ItemList.armor_tungsten_carbide_head = new ArmorTungstenCarbide(ArmorMaterialList.tungsten_carbide, EquipmentSlotType.HEAD, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_tungsten_carbide_head")), ItemList.armor_tungsten_carbide_body = new ArmorTungstenCarbide(ArmorMaterialList.tungsten_carbide, EquipmentSlotType.CHEST, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_tungsten_carbide_body")), ItemList.armor_tungsten_carbide_leggings = new ArmorTungstenCarbide(ArmorMaterialList.tungsten_carbide, EquipmentSlotType.LEGS, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_tungsten_carbide_leggings")), ItemList.armor_tungsten_carbide_boots = new ArmorTungstenCarbide(ArmorMaterialList.tungsten_carbide, EquipmentSlotType.FEET, new Item.Properties().group(EasySteel.easy_steel)).setRegistryName(location("armor_tungsten_carbide_boots")) ); EasySteel.logger.info("Items registered."); } private static ResourceLocation location(String name) { return new ResourceLocation(EasySteel.modid, name); } } } Here is my SteelCrossbow.class that simply extends CrossbowItem. package com.kwpugh.easy_steel.items.steel; import net.minecraft.item.CrossbowItem; public class SteelCrossbow extends CrossbowItem { public SteelCrossbow(Properties propertiesIn) { super(propertiesIn); } } Any thoughts of what I may be missing? Regards
  5. Yep! I realized how stupid that was right after I posted it.
  6. I was going back through the Entity.class to look for other options. I found remove(boolean). This code does what I need, but is it the intended usage of remove(boolean)? if(mob instanceof ZombieEntity || mob instanceof ZombieVillagerEntity) { ((MobEntity) mob).spawnExplosionParticle(); mob.remove(true); mob.entityDropItem(Items.GOLD_NUGGET,1); }
  7. 1) Good point, that is code that I will delete 2) ditto 3) I did not know it was not immediate. In 1.12.2 I had used ((EntityLivingBase) entity).setDead(); which had worked fine, but appears gone in 1.15.1. Also, see code snippet for how I had tried to check if it was alive before doing the drop. That did not work. 4.) I'll take a look at the TranslationTextComponent. if(mob instanceof ZombiePigmanEntity || mob instanceof ZombieEntity || mob instanceof ZombieVillagerEntity) { ((MobEntity) mob).spawnExplosionParticle(); ((LivingEntity) mob).setHealth(0); if(!mob.isAlive()) { mob.entityDropItem(Items.GOLD_NUGGET,1); Gobber2.logger.info("drop executed for " + mob + "," + " values of mobs " + mobs); } }
  8. Hi All, Looking for some help here. I went back to my Udemy Java course and refreshed on the Lists and For each loops to check my thinking, but I am still perplexed. The block does what I want it to do, EXCEPT that the entityDropItem fires any where from 9-12 times each time I spawn a Zombie to test the block. Here is my code: package com.kwpugh.gobber2.blocks; import java.util.List; import java.util.Random; import javax.annotation.Nullable; import com.kwpugh.gobber2.Gobber2; import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.FireBlock; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.MobEntity; import net.minecraft.entity.boss.WitherEntity; import net.minecraft.entity.boss.dragon.EnderDragonEntity; import net.minecraft.entity.item.ArmorStandEntity; import net.minecraft.entity.merchant.villager.VillagerEntity; import net.minecraft.entity.merchant.villager.WanderingTraderEntity; import net.minecraft.entity.monster.ElderGuardianEntity; import net.minecraft.entity.monster.GuardianEntity; import net.minecraft.entity.monster.SkeletonEntity; import net.minecraft.entity.monster.SpellcastingIllagerEntity; import net.minecraft.entity.monster.VexEntity; import net.minecraft.entity.monster.VindicatorEntity; import net.minecraft.entity.monster.ZombieEntity; import net.minecraft.entity.monster.ZombiePigmanEntity; import net.minecraft.entity.monster.ZombieVillagerEntity; import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.passive.DolphinEntity; import net.minecraft.entity.passive.IronGolemEntity; import net.minecraft.entity.passive.WaterMobEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class BlockLooter extends Block { public BlockLooter(Properties properties) { super(properties.func_226896_b_()); } int minTickTime = 5; int maxTickTime = 20; //Start it up when placed @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) { world.getPendingBlockTicks().scheduleTick(pos, state.getBlock(), world.rand.nextInt(maxTickTime - minTickTime + 1)); } //Start it up if wlaked over public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { BlockState stateIn = worldIn.getBlockState(pos); worldIn.getPendingBlockTicks().scheduleTick(pos, stateIn.getBlock(), worldIn.rand.nextInt(maxTickTime - minTickTime + 1)); } //Start it up if right-clicked on @Override public ActionResultType func_225533_a_(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { worldIn.getPendingBlockTicks().scheduleTick(pos, state.getBlock(), worldIn.rand.nextInt(maxTickTime - minTickTime + 1)); player.sendMessage(new StringTextComponent("The Looter is active in a range of 18 blocks")); return ActionResultType.SUCCESS; } @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; } @Override public void func_225534_a_(BlockState state,ServerWorld world, BlockPos pos, Random random) { if(!world.isRemote) { int radius = 18; //Scan the radius for LivingEntity and store in list List<Entity> mobs = world.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius, pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius), e -> (e instanceof LivingEntity)); for(Entity mob : mobs) { System.out.println(mob + "," + mobs); //debuging in console //If a player is within the list, kick start the block if(mob instanceof PlayerEntity) { world.getPendingBlockTicks().scheduleTick(pos, state.getBlock(), random.nextInt(minTickTime)); BlockPos posUp = pos.up(); BlockState flaming = ((FireBlock)Blocks.FIRE).getStateForPlacement(world, posUp); world.setBlockState(posUp, flaming, 11); } // These types of mobs are excluded if(mob instanceof PlayerEntity || mob instanceof ArmorStandEntity || mob instanceof VillagerEntity || mob instanceof WanderingTraderEntity || mob instanceof AnimalEntity || mob instanceof IronGolemEntity || mob instanceof DolphinEntity || mob instanceof WaterMobEntity || mob instanceof GuardianEntity || mob instanceof ElderGuardianEntity || mob instanceof SpellcastingIllagerEntity || mob instanceof VexEntity || mob instanceof VindicatorEntity || mob instanceof WitherEntity || mob instanceof EnderDragonEntity) { continue; } if(mob instanceof ZombiePigmanEntity || mob instanceof ZombieEntity || mob instanceof ZombieVillagerEntity) { ((MobEntity) mob).spawnExplosionParticle(); ((LivingEntity) mob).setHealth(0); mob.entityDropItem(Items.GOLD_NUGGET,1); Gobber2.logger.info("drop executed for " + mob + "," + " values of mobs " + mobs); } } } } @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, @Nullable IBlockReader world, List<ITextComponent> tooltip, ITooltipFlag flag) { super.addInformation(stack, world, tooltip, flag); tooltip.add(new StringTextComponent(TextFormatting.BLUE + "The Looter ")); tooltip.add(new StringTextComponent(TextFormatting.GREEN + "Range: 18 blocks")); } } I have been going through this for hours, trying different things to no avail. Help please. Regards.
  9. I run this command before running the ./gradle build or if I have made name changes outside of the Eclipse environment. find . -name '.DS_Store' -type f -delete It clears out any pesky .DS_Store files out of my eclipse folder
  10. Thank you, that works perfectly. It is so hard to figure out out what they unmapped functions do at this point.
  11. Hi, I am not saying mine is the best code, but it is a working example of working worldgen for ores in 1.15.1. https://github.com/kwpugh/gobber/blob/1.15/src/main/java/com/kwpugh/gobber2/world/OreGenerator.java It works in Overworld, Nether, and The End. Good luck.
  12. Hello Folks, Porting a custom glass block from 1.14.4 to 1.15.1. Added render layer type to make it translucent, but the bottom of the block shows through like X-ray on the ground beneath. I attached a pic that shows a vanilla glass next to my glass for example. Any thoughts? package com.kwpugh.gobber2.blocks; import java.util.List; import javax.annotation.Nullable; import com.kwpugh.gobber2.lists.BlockList; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.GlassBlock; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class BlockGobberGlass extends GlassBlock { public BlockGobberGlass(Properties properties) { super(properties); } @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, @Nullable IBlockReader world, List<ITextComponent> tooltip, ITooltipFlag flag) { super.addInformation(stack, world, tooltip, flag); tooltip.add(new StringTextComponent(TextFormatting.BLUE + "A very sturdy glass block, drops the block when broken")); } } package com.kwpugh.gobber2; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.kwpugh.gobber2.lists.BlockList; import com.kwpugh.gobber2.util.Gobber2_Group; import com.kwpugh.gobber2.util.GobberConfig; import com.kwpugh.gobber2.util.SpecialAbilities; import com.kwpugh.gobber2.util.SupportMods; import com.kwpugh.gobber2.world.OreGenerator; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; //import top.theillusivec4.curios.api.CuriosAPI; //import top.theillusivec4.curios.api.imc.CurioIMCMessage; import net.minecraft.item.ItemGroup; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLDedicatedServerSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.loading.FMLPaths; import top.theillusivec4.curios.api.CuriosAPI; import top.theillusivec4.curios.api.imc.CurioIMCMessage; @Mod(Gobber2.modid) public class Gobber2 { public static Gobber2 instance; public static final String modid = "gobber2"; public static final Logger logger = LogManager.getLogger(modid); public static final ItemGroup gobber2 = new Gobber2_Group(); public Gobber2() { instance = this; ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, GobberConfig.SERVER_CONFIG); GobberConfig.loadConfig(GobberConfig.SERVER_CONFIG, FMLPaths.CONFIGDIR.get().resolve("gobber-general.toml")); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::modSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::serverSetup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); MinecraftForge.EVENT_BUS.register(this); } private void modSetup(final FMLCommonSetupEvent event) { OreGenerator.setupOregen(); OreGenerator.setupNetherOregen(); OreGenerator.setupEndOregen(); MinecraftForge.EVENT_BUS.register(new SpecialAbilities()); logger.info("Mod setup completed"); } private void clientSetup(final FMLClientSetupEvent event) { RenderType cutoutMipped = RenderType.func_228641_d_(); RenderType translucent = RenderType.func_228645_f_(); RenderTypeLookup.setRenderLayer(BlockList.gobber2_plant, cutoutMipped); RenderTypeLookup.setRenderLayer(BlockList.gobber2_plant_nether, cutoutMipped); RenderTypeLookup.setRenderLayer(BlockList.gobber2_plant_end, cutoutMipped); RenderTypeLookup.setRenderLayer(BlockList.gobber2_glass, translucent); RenderTypeLookup.setRenderLayer(BlockList.gobber2_glass_nether, translucent); RenderTypeLookup.setRenderLayer(BlockList.gobber2_glass_end, translucent); logger.info("Mod client setup completed"); } private void serverSetup(final FMLDedicatedServerSetupEvent event) { logger.info("Mod server setup completed"); } private void enqueueIMC(final InterModEnqueueEvent event) { if (SupportMods.CURIOS.isLoaded()) { InterModComms.sendTo("curios", CuriosAPI.IMC.REGISTER_TYPE, () -> new CurioIMCMessage("ring").setSize(2)); } } }
  13. Thank you for the feedback. I'm still new to coding Java and still getting the hang of things. An earlier version of the class relied on the grow() to affect CropsBlock and SaplingsBlock instances. I will need to study some of the other block types (Vines, Stems, etc) to see how those can work. The general nature of the block state.tick() was convenient, but does not seem to have a replacement. Here is were things landed. package com.kwpugh.ring_of_growth; import java.util.List; import net.minecraft.block.BambooBlock; import net.minecraft.block.BambooSaplingBlock; import net.minecraft.block.BlockState; import net.minecraft.block.CropsBlock; import net.minecraft.block.IGrowable; import net.minecraft.block.SaplingBlock; 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.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; /** * * Only effective on Crops, Saplings, and Bamboo until I find an alternative to blockstate.tick() * */ public class ItemRingGrowth extends Item { public ItemRingGrowth(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 equippedMain = player.getHeldItemMainhand(); ItemStack equippedOff = player.getHeldItemOffhand(); if(stack == equippedMain || stack == equippedOff) { 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.func_226277_ct_()+x); int theY = MathHelper.floor(player.func_226278_cu_()+y); int theZ = MathHelper.floor(player.func_226281_cx_()+z); BlockPos targetPos = new BlockPos(theX, theY, theZ); BlockState blockstate = world.getBlockState(targetPos); if ((blockstate.getBlock() instanceof CropsBlock) || (blockstate.getBlock() instanceof SaplingBlock) || (blockstate.getBlock() instanceof BambooBlock) || (blockstate.getBlock() instanceof BambooSaplingBlock)) { IGrowable igrowable = (IGrowable)blockstate.getBlock(); if ((igrowable.canGrow(world, targetPos, blockstate, world.isRemote)) && (player.ticksExisted % 120 == 0)) { if (world instanceof ServerWorld) { if (igrowable.canUseBonemeal(world, world.rand, targetPos, blockstate)) { igrowable.func_225535_a_((ServerWorld)world, world.rand, targetPos, blockstate); } } } } } } } } } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent(TextFormatting.BLUE + "Works on many crops, plants, and trees")); list.add(new StringTextComponent(TextFormatting.GREEN + "Range: 14 blocks")); } } That you for the feedback.
  14. Hello Folks, I'm porting a mod from 1.14.4 to 1.15.1 and I have encountered a strange visual issue with my crops. Here is the 1.15.1 code: package com.kwpugh.gobber2.blocks; import com.kwpugh.gobber2.lists.ItemList; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.CropsBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.IItemProvider; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class BlockGobberPlant extends CropsBlock { public BlockGobberPlant(String name, Properties builder) { super(builder); this.setDefaultState(this.stateContainer.getBaseState().with(this.getAgeProperty(), Integer.valueOf(0))); } protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) { return state.getBlock() == Blocks.FARMLAND; } @OnlyIn(Dist.CLIENT) protected IItemProvider getSeedsItem() { return ItemList.gobber2_seed; } public ItemStack getItem(IBlockReader worldIn, BlockPos pos, BlockState state) { return new ItemStack(this.getSeedsItem()); } } Attached are pics of what it should look like and what it actually looks like. Worked fine in 1.14.4 and presented no errors when brought into the 1.15.1 environment, except the bad texture. Any thoughts?
  15. Hi, You might check out this one: https://www.curseforge.com/minecraft/mc-mods/loot-slash-conquer
  16. Here is my 1.14.4 source code for reference: package com.kwpugh.gobber2.items.rings; import java.util.List; import net.minecraft.block.BambooBlock; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.CactusBlock; import net.minecraft.block.ChorusFlowerBlock; import net.minecraft.block.CocoaBlock; import net.minecraft.block.CoralBlock; import net.minecraft.block.CropsBlock; import net.minecraft.block.IGrowable; import net.minecraft.block.NetherWartBlock; import net.minecraft.block.SaplingBlock; import net.minecraft.block.SugarCaneBlock; import net.minecraft.block.VineBlock; 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.util.text.TextFormatting; 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 equippedMain = player.getHeldItemMainhand(); ItemStack equippedOff = player.getHeldItemOffhand(); if(stack == equippedMain || stack == equippedOff) { 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 tagetPos = new BlockPos(theX, theY, theZ); BlockState blockstate = world.getBlockState(tagetPos); //For basic growing blocks that use tick() if ((blockstate.getBlock() instanceof CropsBlock) || (blockstate.getBlock() instanceof SaplingBlock)) { if (!world.isRemote) { if (player.ticksExisted % 12 == 0) { blockstate.tick(world, tagetPos, world.rand); } } } //For slower growing blocks that use tick() if ((blockstate.getBlock() instanceof VineBlock) || (blockstate.getBlock() instanceof SugarCaneBlock) || (blockstate.getBlock() instanceof NetherWartBlock) || (blockstate.getBlock() instanceof CactusBlock)) { if (!world.isRemote) { if (player.ticksExisted % 5 == 0) { blockstate.tick(world, tagetPos, world.rand); } } } //For faster growing blocks that use tick() if ((blockstate.getBlock() instanceof BambooBlock) || (blockstate.getBlock() instanceof CoralBlock) || (blockstate.getBlock() instanceof CocoaBlock) || (blockstate.getBlock() instanceof ChorusFlowerBlock) ) { if (!world.isRemote) { if (player.ticksExisted % 60 == 0) { blockstate.tick(world, tagetPos, world.rand); // } } } } } } } } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent(TextFormatting.BLUE + "Works on most crops, plants, and trees")); list.add(new StringTextComponent(TextFormatting.GREEN + "Range: 14 blocks")); } } I traced through the forge reference sources and found that it is not called but anything but the StemBlock.class. In 1.15.1, StemBlock appears to use its own method for growing. This may not be the best approach, but it is what I figured out in 1.14.4. If there is a better approach, I would love to hear about it. Regards.
  17. Source code I am porting from 1.14.4 to 1.15.1 package com.kwpugh.gobber2.items.rings; import java.util.List; import com.kwpugh.gobber2.util.EnableUtil; import com.kwpugh.gobber2.util.MagnetRange; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.item.ExperienceOrbEntity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; public class ItemCustomRingAttraction extends Item { public ItemCustomRingAttraction(Properties properties) { super(properties); } int range; public void inventoryTick(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) { if(entity instanceof PlayerEntity && !world.isRemote && EnableUtil.isEnabled(stack)) { PlayerEntity player = (PlayerEntity)entity; boolean init = MagnetRange.getCurrentlySet(stack); if(!init) { range = 0; } else { range = MagnetRange.getCurrentRange(stack); } double x = player.posX; double y = player.posY + 1.5; double z = player.posZ; boolean isPulling; //Scan for and collect items List<ItemEntity> items = entity.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range)); for(ItemEntity e: items) { if(!player.isCrouching() && !e.getPersistentData().getBoolean("PreventRemoteMovement")) //if(!player.isSneaking()) { isPulling = true; double factor = 0.02; e.addVelocity((x - e.posX) * factor, (y - e.posY) * factor, (z - e.posZ) * factor); } } if(items.isEmpty()) { isPulling = false; } //Scan for and collect XP Orbs List<ExperienceOrbEntity> xp = entity.world.getEntitiesWithinAABB(ExperienceOrbEntity.class, new AxisAlignedBB(x - range, y - range, z - range, x + range, y + range, z + range)); for(ExperienceOrbEntity orb: xp) { if(!player.isCrouching()) { isPulling = true; double factor = 0.02; orb.addVelocity((x - orb.posX) * factor, (y - orb.posY) * factor, (z - orb.posZ) * factor); player.onItemPickup(orb, 1); player.giveExperiencePoints(orb.xpValue); orb.remove(); } } if(items.isEmpty()) { isPulling = false; } } } @Override public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) { ItemStack stack = player.getHeldItem(hand); if(!world.isRemote && !(player.isCrouching())) { EnableUtil.changeEnabled(player, hand); player.sendMessage(new StringTextComponent("Attraction ability active: " + EnableUtil.isEnabled(stack))); return new ActionResult<ItemStack>(ActionResultType.SUCCESS, player.getHeldItem(hand)); } if(!world.isRemote && player.isCrouching()) { if(range == 0) { range = 4; MagnetRange.setCurrentRange(stack, range); player.sendMessage(new StringTextComponent("Attraction range set to: " + MagnetRange.getCurrentRange(stack))); } else if(range == 4) { range = 8; MagnetRange.setCurrentRange(stack, range); player.sendMessage(new StringTextComponent("Attraction range set to: " + MagnetRange.getCurrentRange(stack))); } else if(range == 8) { range = 12; MagnetRange.setCurrentRange(stack, range); player.sendMessage(new StringTextComponent("Attraction range set to: " + MagnetRange.getCurrentRange(stack))); } else if(range == 12) { range = 0; MagnetRange.setCurrentRange(stack, range); player.sendMessage(new StringTextComponent("Attraction range set to: " + MagnetRange.getCurrentRange(stack))); } } return super.onItemRightClick(world, player, hand); } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent(TextFormatting.BLUE + "Draws dropped items toward the player")); list.add(new StringTextComponent(TextFormatting.RED + "Attraction ability active: " + EnableUtil.isEnabled(stack))); list.add(new StringTextComponent(TextFormatting.GOLD + "Works while in player inventory")); list.add(new StringTextComponent(TextFormatting.GREEN + "Right-click to toggle on/off, sneak + right-click to cycle through ranges")); } } In the 1.14.4 version, I was calling the public methods for posX, posY, posZ on PlayerEntity, now it is no longer visible due to be changing from public to private within the Entity.class. I am looking for some guidance on how to access these private methods.
  18. Hello, I'm in the process of updating my 1.14.4 mod to 1.15.1. It has an ore generation class that handles interesting custom ores into biomes. Here is the existing class. //My version being ported from 1.14.4 to 1.15.1 public class OreGenerator { public static void setupOregen() { for(Biome biome : ForgeRegistries.BIOMES) { if(GeneralModConfig.BORNITE_ORE_GENERATION.get()) biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(NATURAL_STONE, BlockList.bornite_ore.getDefaultState(), GeneralModConfig.BORNITE_ORE_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(GeneralModConfig.BORNITE_ORE_CHANCE.get(), GeneralModConfig.BORNITE_ORE_MIN_HEIGHT.get(), GeneralModConfig.BORNITE_ORE_MIN_HEIGHT.get(), GeneralModConfig.BORNITE_ORE_MAX_HEIGHT.get()))); if(GeneralModConfig.CASSITERITE_ORE_GENERATION.get()) biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(NATURAL_STONE, BlockList.cassiterite_ore.getDefaultState(), GeneralModConfig.CASSITERITE_ORE_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(GeneralModConfig.CASSITERITE_ORE_CHANCE.get(), GeneralModConfig.CASSITERITE_ORE_MIN_HEIGHT.get(), GeneralModConfig.CASSITERITE_ORE_MIN_HEIGHT.get(), GeneralModConfig.CASSITERITE_ORE_MAX_HEIGHT.get()))); if(GeneralModConfig.WOLFRAMITE_ORE_GENERATION.get()) biome.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(NATURAL_STONE, BlockList.wolframite_ore.getDefaultState(), GeneralModConfig.WOLFRAMITE_ORE_SIZE.get().intValue()), COUNT_RANGE, new CountRangeConfig(GeneralModConfig.WOLFRAMITE_ORE_CHANCE.get(), GeneralModConfig.WOLFRAMITE_ORE_MIN_HEIGHT.get(), GeneralModConfig.WOLFRAMITE_ORE_MIN_HEIGHT.get(), GeneralModConfig.WOLFRAMITE_ORE_MAX_HEIGHT.get()))); } } } In Eclipse with 1.15.1, the createDecoratedFeature highlights with the text of "The method createDecoratedFeature(Feature<OreFeatureConfig>, OreFeatureConfig, Placement<CountRangeConfig>, CountRangeConfig) is undefined for the type Biome". So, I traced the usage difference from 1.14.4 to 1.15.1 1.14.4 version public static void addOres(Biome biomeIn) { biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, Blocks.COAL_ORE.getDefaultState(), 17), Placement.COUNT_RANGE, new CountRangeConfig(20, 0, 0, 128))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, Blocks.IRON_ORE.getDefaultState(), 9), Placement.COUNT_RANGE, new CountRangeConfig(20, 0, 0, 64))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, Blocks.GOLD_ORE.getDefaultState(), 9), Placement.COUNT_RANGE, new CountRangeConfig(2, 0, 0, 32))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, Blocks.REDSTONE_ORE.getDefaultState(), 8), Placement.COUNT_RANGE, new CountRangeConfig(8, 0, 0, 16))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, Blocks.DIAMOND_ORE.getDefaultState(), 8), Placement.COUNT_RANGE, new CountRangeConfig(1, 0, 0, 16))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Biome.createDecoratedFeature(Feature.ORE, new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, Blocks.LAPIS_ORE.getDefaultState(), 7), Placement.COUNT_DEPTH_AVERAGE, new DepthAverageConfig(1, 16, 16))); } 1.15.1 version public static void addOres(Biome biomeIn) { biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, field_226791_az_, 17)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(new CountRangeConfig(20, 0, 0, 128)))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, field_226740_aA_, 9)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(new CountRangeConfig(20, 0, 0, 64)))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, field_226741_aB_, 9)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(new CountRangeConfig(2, 0, 0, 32)))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, field_226742_aC_, 8)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(new CountRangeConfig(8, 0, 0, 16)))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, field_226743_aD_, 8)).func_227228_a_(Placement.COUNT_RANGE.func_227446_a_(new CountRangeConfig(1, 0, 0, 16)))); biomeIn.addFeature(GenerationStage.Decoration.UNDERGROUND_ORES, Feature.ORE.func_225566_b_(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, field_226744_aE_, 7)).func_227228_a_(Placement.COUNT_DEPTH_AVERAGE.func_227446_a_(new DepthAverageConfig(1, 16, 16)))); } I noticed the differences, but I don't understand what the "functionalists_255566_b" variable refers to in the 1.15.1 version. I'm hoping someone could explain the format change. Thank you in advance.
  19. That works exactly the way I want, thank you all!
  20. I got this error: "The method setBlockState(BlockPos, BlockState, int) in the type World is not applicable for the arguments (BlockState, BlockPos, int)" Switched it around to this: world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); That got rid of the error. I tested in game and gravel still does not fall and water still does not flow. Any other thoughts or might this be a bug? I was looking through the world.class and saw that flags 16 and 32 both PREVENT neighbor reactions, is there a flag to CAUSE neighbor reactions as like a normal block break? Regards.
  21. Hi Everyone, I'm looking for some guidance on figure out a better way to remove blocks on right-click with a modded item. Here is my code: package com.kwpugh.easy_steel.items; import java.util.List; import com.kwpugh.easy_steel.lists.BlockList; import com.kwpugh.easy_steel.lists.ItemList; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.IItemTier; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.item.Items; import net.minecraft.item.PickaxeItem; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; public class CrackHammer extends PickaxeItem { Block block; public CrackHammer(IItemTier tier, int attackDamageIn, float attackSpeedIn, Properties builder) { super(tier, attackDamageIn, attackSpeedIn, builder); } @Override public ActionResultType onItemUse(ItemUseContext context) { World world = context.getWorld(); PlayerEntity player = context.getPlayer(); BlockPos pos = context.getPos(); BlockState state = world.getBlockState(pos); Block block = state.getBlock(); ItemStack stack = context.getItem(); Direction face = context.getFace(); if (!world.isRemote && state.getBlockHardness(world, pos) != 0.0F) { stack.damageItem(1, player, (p_220038_0_) -> { p_220038_0_.sendBreakAnimation(EquipmentSlotType.MAINHAND); }); } if(block == Blocks.COAL_ORE) { world.destroyBlock(pos, false); world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemList.carbon_chunk, 2))); } if(block == Blocks.IRON_ORE) { world.destroyBlock(pos, false); world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemList.iron_chunk, 2))); } if(block == Blocks.GOLD_ORE) { world.destroyBlock(pos, false); world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemList.gold_chunk, 2))); } if(block == Blocks.DIAMOND_ORE) { world.destroyBlock(pos, false); world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemList.diamond_chunk, 2))); } if(block == BlockList.bornite_ore) { world.destroyBlock(pos, false); world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemList.copper_chunk, 3))); } if(block == BlockList.cassiterite_ore) { world.destroyBlock(pos, false); world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemList.tin_chunk, 2))); } if(block == BlockList.wolframite_ore) { world.destroyBlock(pos, false); world.addEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ItemList.tungsten_chunk, 2))); } return ActionResultType.PASS; } @Override public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return true; } @Override public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { return repair.getItem() == Items.IRON_INGOT; } @Override public void addInformation(ItemStack stack, World world, List<ITextComponent> list, ITooltipFlag flag) { super.addInformation(stack, world, list, flag); list.add(new StringTextComponent(TextFormatting.GREEN + "Used to break various ores into chunks")); list.add(new StringTextComponent(TextFormatting.BLUE + "Right-click on ore to use")); } } Problem with the world.destoryBlock() is that it sets to air and causes odd effects in the world (e.g. gravel above the block destroyed does not fall, water next to the block does not flow. world.removeBlock() does the same thing. Is there a better method or approach to use? Regards.
×
×
  • Create New...

Important Information

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