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

HenryRichard

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by HenryRichard

  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.
  16. I've been trying to integrate my mod with Tinker's Construct by adding some customized tool parts, but I've been trying for the past few days and have absolutely nothing working. I've googled this about thirty times, but nothing I found seems to work for me. Toolparts with my material aren't showing up in the Tinker's Toolparts creative tab, aren't craftable in the part maker, and if I try to use commands to give myself a tool part, it just says "Missing Material: Pinkite." Here's the code I'm trying to use: package henryrichard.epicwasteoftime.init; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.event.FMLInterModComms; import net.minecraftforge.fml.common.registry.GameRegistry; public class EWOTTConstruct { public static void preInitTConstruct() { if(Loader.isModLoaded("tconstruct")) { System.out.println("Tinker's Construct found! Doing some neat setup stuff..."); addToolMaterial(50, "Pinkite", 1, 1200, 6, 1, 0.1f, TextFormatting.RED.toString(), 255 << 24 | 120 << 16 | 255 << 8 | 40, 1, 0.1f, 2.3f, 6, EWOTItems.pinkiteIngot); System.out.println("Done with neat setup stuff!"); } else { System.out.println("Tinker's Construct not found. Skipped neat setup stuff."); } } private static void addToolMaterial(int id, String name, int harvestLevel, int durability, int miningSpeed, int attack, float handleModifier, String style, int color, int bowDrawSpeed, float bowProjectileSpeed, float projectileMass, int projectileFragility, Item material) { NBTTagCompound tag = new NBTTagCompound(); tag.setInteger("Id", id); // Unique material ID. Reseved IDs: 0-40 Tinker, 41-45 Iguana Tinker Tweaks, 100-200 ExtraTiC tag.setString("Name", name); // Unique material name tag.setInteger("HarvestLevel", harvestLevel); tag.setInteger("Durability", durability); tag.setInteger("MiningSpeed", miningSpeed); tag.setInteger("Attack", attack); // optional tag.setFloat("HandleModifier", handleModifier); //tag.setInteger("Reinforced", 0); // optional //tag.setFloat("Stonebound", 0); // optional, cannot be used if jagged //tag.setFloat("Jagged", 0); // optional, cannot be used if stonebound tag.setString("Style", style); // optional, color of the material text //tag.setInteger("Color", 255 << 24 | 45 << 16 | 45 << 8 | 40); tag.setInteger("Color", color); // argb /* SINCE 1.8.2 - bow and arrow stats * for bow and arrow stats, best compare to other materials to find good values */ // additional stats for bows tag.setInteger("Bow_DrawSpeed", bowDrawSpeed); // the higher the longer it takes to draw the bow tag.setFloat("Bow_ProjectileSpeed", bowProjectileSpeed); // the higher the faster the projectile goes // additional stats for arrows tag.setFloat("Projectile_Mass", projectileMass); tag.setFloat("Projectile_Fragility", projectileFragility); // This is a multiplier to the shafts break-chance FMLInterModComms.sendMessage("tconstruct", "addMaterial", tag); /* SINCE 1.8.3 - material mappings * This maps an item to a material so it can be used for repairing etc. */ tag = new NBTTagCompound(); tag.setInteger("MaterialId", id); //tag.setInteger("Value", 2); // 1 material ever 2 value. See PartMapping IMC NBTTagCompound item = new NBTTagCompound(); (new ItemStack(material)).writeToNBT(item); tag.setTag("Item", item); FMLInterModComms.sendMessage("tconstruct", "addMaterialItem", tag); /* This part adds mappings, so that you can convert items to toolparts in the Part Builder. Stone Parts are used as the baseline for what exists */ tag = new NBTTagCompound(); tag.setInteger("MaterialId", id); // output material id item = new NBTTagCompound(); (new ItemStack(material)).writeToNBT(item); tag.setTag("Item", item); FMLInterModComms.sendMessage("tconstruct", "addPartBuilderMaterial", tag); } } I'm calling preInitTConstruct() in my mod's CommonProxy's preInit method, after all my items have been declared and registered (so pinkiteIngot isn't null). I've also tried calling it in my init method, same result. Tinker's Construct is installed and my mod knows it, since Loader.isModLoaded("tconstruct") is true and stuff gets printed to the console. I just don't know what to do now. Any ideas?
  17. It's working perfectly now - thanks so much! Here's my finished code for everything, in case someone in the future want to do a similar thing: @SubscribeEvent public void enditeBreakSpeedEvent(PlayerEvent.BreakSpeed e) { if(e.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND) != null && e.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof IEndTool && e.getEntityPlayer().dimension == 1) { e.setNewSpeed(e.getOriginalSpeed() * ; } } @SubscribeEvent public void enditeLivingHurtEvent(LivingHurtEvent e) { if(e.getEntity().dimension == 1 && e.getSource().getEntity() instanceof EntityLivingBase) { EntityLivingBase attacker = (EntityLivingBase) e.getSource().getEntity(); if(attacker.getHeldItem(EnumHand.MAIN_HAND) != null && attacker.getHeldItem(EnumHand.MAIN_HAND).getItem() == EWOTItems.enditeSword) { e.setAmount(e.getAmount() * 4); } } }
  18. I'm the stupid one - I didn't even check EntityPlayer! It's kinda working now - the main problem is that it's now making endermen teleport, as well as the more minor problem of not technically having the attack come from the attacker. I'm pretty sure it's because I'm attacking as DamageSource.generic, so that may have to change. There doesn't seem to be any way to set LivingAttackEvent.amount, so I'm not really sure what to do from here. BTW Here's the current code: @SubscribeEvent public void enditeLivingAttackEvent(LivingAttackEvent e) { if(e.getEntity().dimension == 1 && e.getSource().getSourceOfDamage() instanceof EntityLivingBase) { EntityLivingBase attacker = (EntityLivingBase) e.getSource().getSourceOfDamage(); if(attacker.getHeldItem(EnumHand.MAIN_HAND) != null && attacker.getHeldItem(EnumHand.MAIN_HAND).getItem() == EWOTItems.enditeSword) { //Not sure what to do here } } }
  19. Alright - I discovered e.getSource().getSourceOfDamage() instanceof EntityLiving is returning false. Now the question is what can I do about that? Is there a different event I should be using?
  20. I'll look into messing with the tooltip in a bit. It is executing - "enditeLivingAttackEvent!" is printed every time something takes damage (sometimes several times - no idea what's causing that), but it never progresses past that. I've tested it both in and out of The End and it doesn't do anything out of the ordinary either way.
  21. That solves half of it, though I now need to make the sword deal quadruple damage. I'm trying to use this: @SubscribeEvent public void enditeLivingAttackEvent(LivingAttackEvent e) { System.out.println("enditeLivingAttackEvent!"); if(e.getEntity() != null && e.getEntity().dimension == 1 && e.getSource().getSourceOfDamage() instanceof EntityLiving) { System.out.println("entity isn't null, is in end, and was attacked by EntityLiving!"); EntityLiving attacker = (EntityLiving) e.getSource().getSourceOfDamage(); if(attacker.getHeldItem(EnumHand.MAIN_HAND) != null && attacker.getHeldItem(EnumHand.MAIN_HAND).getItem() == EWOTItems.enditeSword) { System.out.println("IT'S SUPER EFFECTIVE!"); e.getEntityLiving().attackEntityFrom(DamageSource.generic, e.getAmount() * 3); } } } But it's not working. If possible I'd like to use something similar to the code in my first post so that the tooltip showing the attack damage updates, though I'd understand if that wasn't possible without making a coremod (which sounds like a bad idea).
  22. I'm trying to make some tools that work better in The End. Currently I'm doing this: public float getStrVsBlock(ItemStack stack, IBlockState state) { float strength = super.getStrVsBlock(stack, state); //TODO: make this not client only if(Minecraft.getMinecraft().thePlayer.dimension == 1) { strength *= 8; } return strength; } /** * ItemStack sensitive version of getItemAttributeModifiers */ public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) { Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create(); double atk = (double)this.attackDamage; //TODO: make this not client only try { if(Minecraft.getMinecraft() != null && Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.dimension == 1) { atk *= 4; } } finally { } if (slot == EntityEquipmentSlot.MAINHAND) { multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", atk, 0)); multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Weapon modifier", -2.4000000953674316D, 0)); } return multimap; } However, since Minecraft is a client-only class, this will crash a server. I don't know of a way I can get a player from an ItemStack, IBlockState, or EntityEquipmentSlot. I could potentially use NBT data that gets set when the tool is equipped, but that seems messy and a little hacky and I'd rather not do it if there's a better way. Any ideas?
  23. I'm trying to remake a mod I made a while back to 1.10, and quite a few of the items in it set the player's speed in some way. I was working on the simplest one: a sword that launches both you and your target in the air. I used this code: package henryrichard.epicwasteoftime.item.tool; import henryrichard.epicwasteoftime.EWOTMain; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; public class UpliftingSwordItem extends ItemSword { public UpliftingSwordItem(String unlocalizedName, String registryName, ToolMaterial material, CreativeTabs tab) { super(material); this.setUnlocalizedName(EWOTMain.MODID + "." + unlocalizedName); this.setRegistryName(registryName); this.setCreativeTab(tab); } public UpliftingSwordItem(String unlocalizedName, String registryName, ToolMaterial material) { this(unlocalizedName, registryName, material, CreativeTabs.COMBAT); } public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase player) { target.motionX = 0D; target.motionY = 1D; target.motionZ = 0D; player.motionX = 0D; player.motionY = 1D; player.motionZ = 0D; item.damageItem(1, player); return true; } } However, this only sets the target's speed, and not the player. In 1.8 I could use this code: ((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(player)); However, this no longer works in 1.10.2 (It probably was removed in 1.9, but I haven't worked with that at all). Does anyone know how to fix this?
  24. Still haven't figured this out. Is there a method in World to update lighting? I can't find it if it exists.
×
×
  • Create New...

Important Information

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