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

deerangle

Members
  • Content Count

    259
  • Joined

  • Last visited

  • Days Won

    1

deerangle last won the day on January 26 2019

deerangle had the most liked content!

Community Reputation

17 Good

About deerangle

  • Rank
    Diamond Finder

Converted

  • Gender
    Undisclosed
  • Personal Text
    I love Minecraft Forge!

Recent Profile Visitors

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

  1. Fixed by using this.getWorld().func_234923_W_()
  2. I want to send a packet to all players near my tileentity in the current dimension: PacketHandler.INSTANCE.send(PacketDistributor.NEAR.with(PacketDistributor.TargetPoint.p(pos.getX(), pos.getY(), pos.getZ(), 64, ???)), new RqUpdateWandTablePacket(getPos())); What do I use for the dimension? it requires a RegistryKey<World> . How do I get that?
  3. How do I make sure Itemstack#getTag doesn't return null every time? How do I make my Item have a tag? I'm not sure what to use. Should I call getOrCreateTag somewhere?
  4. I have made an Item that has a Capability. I can use the capability without issues for the most part. The data persists on save/load world too. However, when I change the ItemStack (move it to another slot) when running dedicated server and client, the data just disappears. Here is the Item class: public class LaptopItem extends Item { private static final ITextComponent containerName = new TranslationTextComponent("container.rubymod.laptop"); public LaptopItem(Properties group) { super(group); } @Nullable @Override public ICapabilityProvider initCapabili
  5. During initialization. I just updated my workspace from 31.1.45 to 31.1.46. It's working now (fires when loading the world). I don't know if it was the version bump that fixed it, but probably It was not firing because I wasn't loading a world. Anyway, it's working now and I can access the capability.
  6. I was trying to add a capability, but for some reason, the AttachCapabilitiesEvent isn't being fired (checked with breakpoints). I checked multiple times but couldn't find anything wrong with my Event handler. Here is the relevant code: @Mod.EventBusSubscriber(bus= Mod.EventBusSubscriber.Bus.FORGE, modid=RubyMod.MODID) public class ForgeRegistry { public static final ResourceLocation COMPUTER_STORAGE_CAP = new ResourceLocation(RubyMod.MODID, "computer_storage"); @SubscribeEvent public static void onAttachCapabilities(AttachCapabilitiesEvent<TileEntity> event) {
  7. For anyone interested in using the Event method in favor of Reflection: public class EventHandler { public static Map<Block, Block> BLOCK_STRIPPING_MAP = new HashMap<>(); static { BLOCK_STRIPPING_MAP.put(Registry.BEECH_LOG_BLOCK, Registry.STRIPPED_BEECH_LOG_BLOCK); BLOCK_STRIPPING_MAP.put(Registry.BEECH_WOOD_BLOCK, Registry.STRIPPED_BEECH_WOOD_BLOCK); } @SubscribeEvent public static void onBlockClicked(PlayerInteractEvent.RightClickBlock event) { if (event.getItemStack().getItem() instanceof AxeItem) { World world = eve
  8. Honestly, I'm ashamed that that using an event isn't the first thing I thought of... ?
  9. I used the following field name to get this to work (also when building and running outside of the development environment): ObfuscationReflectionHelper.findField(AxeItem.class, "field_203176_a")
  10. I was facing the same problem in my mod. I used the following solution: private static void addStripping() throws NoSuchFieldException, IllegalAccessException { Field map = ObfuscationReflectionHelper.findField(AxeItem.class, "BLOCK_STRIPPING_MAP"); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(map, map.getModifiers() & ~Modifier.FINAL); map.setAccessible(true); Map<Block, Block> strip_map = (Map<Block, Block>) map.get(null); HashMap<Block, Block> new_map = new
  11. I have a log block in my mod, and I want to make it possible to strip when right-clicked with an axe. Currently, I am using this horrible method with reflection: private static void addStripping() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException { Class clazz = Class.forName("net.minecraft.item.AxeItem"); Field map = clazz.getDeclaredField("BLOCK_STRIPPING_MAP"); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(map, map.getModifiers() & ~Modifier.FINAL); map.s
  12. Works like a charm and was way easier than copying the entire SignTileEntity class. Thanks for your help!
  13. public class BeechSignTileEntity extends SignTileEntity { public BeechSignTileEntity() { super(Registry.SIGN_TE); // doesn't work } } I made my own TileEntity. I extended SignTileEntity. However, I can't pass my TileEntityType to the superconstructor because the superconstructor doesn't accept a TileEntityType.
×
×
  • Create New...

Important Information

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