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

HenryRichard

Members
  • Posts

    42
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    Personal Text

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

HenryRichard's Achievements

Tree Puncher

Tree Puncher (2/8)

3

Reputation

  1. It is under External Libraries - it'll look something like "Gradle: net.minecraftforge:forge:1.14.4". The assets will be in net.minecraft:client:extra.
  2. I'm attempting to make two ore blocks which, when broken, will spawn a slime and a magma cube respectively. When the world's difficulty is set to Peaceful, I'd like to just spawn the drops, which will be affected by the player's tool's fortune level the same way a normal kill would be affected by looting. I'd like this to be compatible with any datapack or mod that modifies the loot tables for slimes and magma cubes. So far, I have the following code: @Override public void spawnAdditionalDrops(BlockState state, World world, BlockPos pos, ItemStack stack) { super.spawnAdditionalDrops(state, world, pos, stack); if (!world.isRemote && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) == 0) { SlimeEntity entity = slimeType.create(world); if(entity != null) { entity.setSlimeSize(1, true); if (world.getDifficulty() != Difficulty.PEACEFUL) { //spawn the entity entity.setLocationAndAngles( pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D, MathHelper.nextFloat(world.getRandom(), -180f, 179.9f), 0.0F ); world.addEntity(entity); entity.spawnExplosionParticle(); } else { //get entity drops and spawn them in instead if(world.getServer() != null) { int fortuneLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack); ItemStack weapon = new ItemStack(Items.IRON_SWORD); EnchantmentHelper.setEnchantments(ImmutableMap.of(Enchantments.LOOTING, fortuneLevel), weapon); FakePlayer fakePlayer = FakePlayerFactory.getMinecraft((ServerWorld) world); fakePlayer.setItemStackToSlot(EquipmentSlotType.MAINHAND, weapon); LootTable loot = world.getServer().getLootTableManager().getLootTableFromLocation(entity.getLootTableResourceLocation()); LootContext context = new LootContext.Builder((ServerWorld) world) .withRandom(world.getRandom()) .withParameter(LootParameters.THIS_ENTITY, entity) .withParameter(LootParameters.POSITION, pos) .withParameter(LootParameters.DAMAGE_SOURCE, DamageSource.causePlayerDamage(fakePlayer)) .build(LootParameterSets.ENTITY); List<ItemStack> drops = loot.generate(context); for (ItemStack drop : drops) { spawnAsEntity(world, pos, drop); } } } } } } The entity spawning works perfectly; there's no issue there. The issues arise when working with the loot tables. First, I can't seem to get the fortune/looting to work at all - I suspect it has to do with me getting the fake player wrong. There may be a much better way of achieving the same effect without using a fake player at all - if so I'd much prefer that. Second, the magma cube block doesn't ever drop magma cream, despite it supposedly being a 1/4 chance. Anyone have any ideas? Side note - I'm using an access transformer to make setSlimeSize public (it's normally protected).
  3. I'm trying to make a set of armor that has a greater protection value in The End than in other dimensions. As of now I plan to do this by changing the specific armor ItemStack's attribute modifiers whenever the entity wearing it travels to another dimension or equips the armor; however it seems like there should be a better way to achieve the same effect. Is there one at this point?
  4. Is this better? package henryrichard.ewot.init; import henryrichard.ewot.util.EwotReference; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.ObjectHolder; @Mod.EventBusSubscriber(modid = EwotReference.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) @ObjectHolder(EwotReference.MODID) public abstract class EwotBlocks { public static final Block amethyst_ore = null; public static final Block endust_ore = null; public static final Block aluminum_ore = null; public static final Block flint_ore = null; public static final Block amethyst_block = null; public static final Block endust_block = null; public static final Block aluminum_block = null; public static final Block unalloyed_endite_block = null; public static final Block endite_block = null; public static final Block nether_planks = null; public static final Block glowwool = null; public static final Block jeb_wool = null; private static final BlockCreator[] bcrArray = { new BlockCreator("amethyst_ore", Block.Properties.create(Material.ROCK, MaterialColor.NETHERRACK).hardnessAndResistance(3.0F, 3.0F)), new BlockCreator("endust_ore", Block.Properties.create(Material.ROCK, MaterialColor.SAND).hardnessAndResistance(5.0F, 9.0F)), new BlockCreator("aluminum_ore", Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)), new BlockCreator("flint_ore", Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)), new BlockCreator("amethyst_block", Block.Properties.create(Material.IRON, MaterialColor.PURPLE).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), new BlockCreator("endust_block", Block.Properties.create(Material.IRON, MaterialColor.CYAN).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), new BlockCreator("aluminum_block", Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), new BlockCreator("unalloyed_endite_block", Block.Properties.create(Material.IRON, MaterialColor.LIGHT_BLUE_TERRACOTTA).hardnessAndResistance(6.0F, 10.0F).sound(SoundType.METAL)), new BlockCreator("endite_block", Block.Properties.create(Material.IRON, MaterialColor.CYAN).hardnessAndResistance(6.0F, 10.0F).sound(SoundType.METAL)), new BlockCreator("nether_planks", Block.Properties.create(Material.WOOD, MaterialColor.RED_TERRACOTTA).hardnessAndResistance(2.0F, 3.0F).sound(SoundType.WOOD)), new BlockCreator("glowwool", Block.Properties.create(Material.CLOTH, MaterialColor.YELLOW).hardnessAndResistance(0.8F).sound(SoundType.CLOTH).lightValue(15)), new BlockCreator("jeb_wool", Block.Properties.create(Material.CLOTH, MaterialColor.SNOW).hardnessAndResistance(0.8F).sound(SoundType.CLOTH)), }; @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { Block[] blocks = new Block[bcrArray.length]; for(int i=0; i<bcrArray.length; i++) { blocks[i] = bcrArray[i].getBlock(); } event.getRegistry().registerAll(blocks); } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event) { Item[] items = new Item[bcrArray.length]; for(int i=0; i<bcrArray.length; i++) { items[i] = bcrArray[i].getItem(); } event.getRegistry().registerAll(items); } //Nested class to create blocks more easily private static class BlockCreator { private Block.Properties blockProp; private Item.Properties itemProp; private String registryName; private Block theBlock; private Item theItem; private BlockCreator(String r, Block.Properties b, Item.Properties i) { blockProp = b; itemProp = i; registryName = r; } private BlockCreator(String r, Block.Properties b) { this(r, b, new Item.Properties().group(EwotItemGroups.EWOT_BLOCKS)); } private Block getBlock() { if(theBlock == null) { theBlock = new Block(blockProp).setRegistryName(registryName); } return theBlock; } private Item getItem() { if(theItem == null) { theItem = new ItemBlock(getBlock(), itemProp).setRegistryName(registryName); } return theItem; } } }
  5. I've been working on a 1.13.2 mod that's still in its infancy. When adding blocks, I wanted to be able to add just one line of code for the Block itself and the ItemBlock. I wrote some code to do this, and it seems to work well. However, I want to be sure I'm not causing issues with compatibility or going against a style rule. Additionally, I'm not positive if I should be declaring my blocks and registering them in the same file or not. Here is my code: package henryrichard.ewot.init; import henryrichard.ewot.util.EwotReference; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.ObjectHolder; @Mod.EventBusSubscriber(modid = EwotReference.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) @ObjectHolder(EwotReference.MODID) public abstract class EwotBlocks { public static final Block amethyst_ore = null; public static final Block endust_ore = null; public static final Block aluminum_ore = null; public static final Block flint_ore = null; public static final Block amethyst_block = null; public static final Block endust_block = null; public static final Block aluminum_block = null; public static final Block unalloyed_endite_block = null; public static final Block endite_block = null; public static final Block nether_planks = null; public static final Block glowwool = null; public static final Block jeb_wool = null; private static final BlockCreator[] bcrArray = { new BlockCreator("amethyst_ore", Block.Properties.create(Material.ROCK, MaterialColor.NETHERRACK).hardnessAndResistance(3.0F, 3.0F)), new BlockCreator("endust_ore", Block.Properties.create(Material.ROCK, MaterialColor.SAND).hardnessAndResistance(5.0F, 9.0F)), new BlockCreator("aluminum_ore", Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)), new BlockCreator("flint_ore", Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F)), new BlockCreator("amethyst_block", Block.Properties.create(Material.IRON, MaterialColor.PURPLE).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), new BlockCreator("endust_block", Block.Properties.create(Material.IRON, MaterialColor.CYAN).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), new BlockCreator("aluminum_block", Block.Properties.create(Material.IRON, MaterialColor.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL)), new BlockCreator("unalloyed_endite_block", Block.Properties.create(Material.IRON, MaterialColor.LIGHT_BLUE_TERRACOTTA).hardnessAndResistance(6.0F, 10.0F).sound(SoundType.METAL)), new BlockCreator("endite_block", Block.Properties.create(Material.IRON, MaterialColor.CYAN).hardnessAndResistance(6.0F, 10.0F).sound(SoundType.METAL)), new BlockCreator("nether_planks", Block.Properties.create(Material.WOOD, MaterialColor.RED_TERRACOTTA).hardnessAndResistance(2.0F, 3.0F).sound(SoundType.WOOD)), new BlockCreator("glowwool", Block.Properties.create(Material.CLOTH, MaterialColor.YELLOW).hardnessAndResistance(0.8F).sound(SoundType.CLOTH).lightValue(15)), new BlockCreator("jeb_wool", Block.Properties.create(Material.CLOTH, MaterialColor.YELLOW).hardnessAndResistance(0.8F).sound(SoundType.CLOTH)), }; @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { Block[] blocks = new Block[bcrArray.length]; for(int i=0; i<bcrArray.length; i++) { blocks[i] = bcrArray[i].theBlock; } event.getRegistry().registerAll(blocks); } @SubscribeEvent public static void registerItemBlocks(RegistryEvent.Register<Item> event) { Item[] items = new Item[bcrArray.length]; for(int i=0; i<bcrArray.length; i++) { items[i] = bcrArray[i].theItem; } event.getRegistry().registerAll(items); } //Nested class to create blocks more easily private static class BlockCreator { private Block.Properties blockProp; private Item.Properties itemProp; private Block theBlock; private Item theItem; private BlockCreator(String r, Block.Properties b, Item.Properties i) { blockProp = b; itemProp = i; theBlock = new Block(blockProp).setRegistryName(r); theItem = new ItemBlock(theBlock, itemProp).setRegistryName(r); } private BlockCreator(String r, Block.Properties b) { this(r, b, new Item.Properties().group(EwotItemGroups.EWOT_BLOCKS)); } } }
  6. That seems to have worked! Thanks! I don't know why it didn't work before though.
  7. Bump - does no one actually know how to do this?
  8. Like I said twice before, that version is outdated. Alchemy is unfinished, and there is no ashen armor. That's why I wanted to decompile the latest version from CurseForge. I already fixed the bug in the version from GitHub before realizing it was old.
  9. I do - BON2 is only giving me an option for 1.8 though. EDIT: I just found a version on Jenkins that has an option for 1.10.2 - will post results in a second. EDIT 2: Same issue again - didn't fully deobfuscate.
  10. Alright - how do I get it to work? I tried running the Embers mod file through it and then decompiling it using CFR, but the same problem I had originally persists. BON2 is in my MDK folder, though I noticed that it only gives me an option for forge 1.8 - I assume I need to add Forge 1.10.2 but I have no idea how. It does seem like a few methods were fixed, so I'm on the right track I'm sure.
  11. Like I said, I downloaded the latest 1.10.2 version I could find, but it was outdated. I'd love it if it was that simple, but I don't think it is. If that's the only way possible I can use the outdated version, but I'd rather not if at all possible.
  12. I'm trying to decompile Embers to fix a duplication bug in the latest release of 1.10.2 (which the developer no longer supports). I was able to fix it in the source on GitHub; but the latest 1.10.2 version there is outdated. I tried to use CFR to decompile it, but since Minecraft's source is obfuscated I got a bunch of methods that I can't understand - I guess I could go through and try to fix each individual one but that would probably take longer than actually rewriting the mod from scratch. I also briefly looked at BON2, but I didn't see any documentation on it and I couldn't get it to work. Does anyone here know how I could do this? I have a feeling some of these things could potentially work if I actually knew how to use them better, but if there are programs that work I'm completely willing to use them.
  13. I decided to look into the source for TConstruct and decided to just try and use the same code it used for registering materials - and lo and behold, it worked! I think the IMC for Tinker's Construct wasn't carried over past 1.7, so you now have to do something like this: Material pinkite = new Material("pinkite", 0xffddff); TinkerMaterials.materials.add(pinkite); pinkite.setCraftable(true); pinkite.addItemIngot("ingotPinkite"); pinkite.setRepresentativeItem(new ItemStack(EWOTItems.pinkiteIngot)); pinkite.addTrait(TinkerTraits.dense, MaterialTypes.HEAD); pinkite.addTrait(TinkerTraits.duritos); TinkerRegistry.addMaterialStats(pinkite, new HeadMaterialStats(700, 6.00f, 3.00f, HarvestLevels.IRON), new HandleMaterialStats(0.50f, 350), new ExtraMaterialStats(150), new BowMaterialStats(0.5f, 1.5f, 7f)); TinkerIntegration.integrationList.add(new MaterialIntegration(pinkite));
  14. I suppose you can't just make the white keys unpressable if a black key is pressed? I don't have any experience with GUIs, so I don't know if that's possible.
  15. Your problem is you're trying to install a mod for minecraft 1.7.10 on minecraft 1.11.2. A lot of stuff has changed since then, so it definitely won't work. You'll need to install minecraft 1.7.10 and then forge for that version.
×
×
  • Create New...

Important Information

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