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

CommandCore

Members
  • Content Count

    36
  • Joined

  • Last visited

Everything posted by CommandCore

  1. Hey all, I was wondering how I would copy the contents of a TileEntity to another, such as copying a chest's contents, or a furnace's items and cook time, etc., to another chest/furnace that already exists in the world. Any help is appreciated. Cheers.
  2. Solved. Removed @OnlyIn from HeartballEntity and added this to the end of my Entity class: @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } Thanks for the help, Cheers.
  3. Sure: HeartballRenderer.java package com.agilapathy.twodotx.entities.heartball; import com.agilapathy.twodotx.TwoDotXMod; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.ResourceLocation; import net.minecraft.util.mat
  4. I tried this with no luck: RenderingRegistry.registerEntityRenderingHandler(RegistryHandler.HEARTBALL_PROJECTILE.get(), HeartballRenderer::new);
  5. My projectile is working completely as intended, but it's invisible for some reason. I think it has something to do with how I'm registering its renderer. Here I'm using an item to spawn it, identical to how a dragon would shoot a fireball: Here's my Registry Object entry: public static final RegistryObject<EntityType<HeartballEntity>> HEARTBALL_PROJECTILE = ENTITIES.register("heartball", () -> EntityType.Builder.<HeartballEntity>create(HeartballEntity::new, EntityClassification.MISC).size(0.25F, 0.25F).trackingRange(4).func_23
  6. I'm trying to find a way to change the water color of vanilla biomes. I know that you can do this for custom biomes, but how would I go about this for vanilla biomes? Example: turning desert water into a light-ish yellow. Cheers.
  7. Got it. I wasn't eager to do it at first because I thought you weren't able to specify the item used, but I found out that you can through event.getItemStack().getItem() Thanks man.
  8. Hey all, I'm trying to get something to happen when a beehive or bee nest is harvested (Getting honeycombs from it) but I've already tried overriding shears (it's called on the block before the onUtemUse of the shears, so that's never called when the honey level is 5 on a bee nest or beehive) I also tried overriding the vanilla block, but bee's seem to be able to go into the hive, just not make honey It would be nice if there was some sort of PlayerEvent.HarvestBeehive event or something, but I can't seem to find one that can match that. Any other ideas, or maybe I'm mi
  9. Okay then, I'm gonna mark this as solved because I got a working product. I guess people can open another thread for efficiency of this method. ๐Ÿ‘
  10. Ah, I see. So unnecessary casting and assigning of variables via strings is the culprit of this bad practice? Does this contribute to inefficiency? From that site you posted, that seems to be the case.
  11. Because I wanted the ability to add custom values when setting them. For example, I wouldn't have to go into the capability and add a new variable, I can just say "Set the variable 'Working' to 'true'." And if its trying to get a variable that hasn't been set yet, it'll return 0 or "" depending on what kind of variable I set it as, (Notice the "string" argument.) Its sort of mimicking the stuff you can do with getPersistentData() on an entity. TLDR; Convenience. ยฏ\_(ใƒ„)_/ยฏ
  12. Got it. Moved it to the client event class. Everything seems to be working. It is a Forge capability, with an interface, class, provider, and storage, along with a AttachCapabilitiesEvent<Entity> called in a class to attach it to PlayerEntity's. Sorry if that wasn't clear in my last post. Unless you're talking about a capability that is already in Forge?
  13. Alright, put this in a class that's only for client events. private static final Field field = ObfuscationReflectionHelper.findField(Minecraft.class, "field_71467_ac"); @SubscribeEvent public static void onClientTickEvent(TickEvent.ClientTickEvent event) throws IllegalAccessException { if(event.phase == TickEvent.Phase.START) { try { if(CustomCapabilities.getPlayer(Minecraft.getInstance().player).getVariable("string", "HasBrokenMyBlock").equals("true")){ field.setInt(Minecraft.getInstance(), 0);
  14. I believe this new version covers everything you said. I used an attached player capability for the boolean. private static final Field field = ObfuscationReflectionHelper.findField(Minecraft.class, "rightClickDelayTimer"); @SubscribeEvent public void onClientTickEvent(TickEvent.ClientTickEvent event) throws IllegalAccessException { if(event.phase == TickEvent.Phase.START) { try { if(CustomCapabilities.getPlayer(Minecraft.getInstance().player).getVariable("string", "HasBrokenMyBlock").equals("true")){ field.setInt(M
  15. I see. Okay, so I did this, and it works, but am I doing it wrong still?: private static boolean brokeMyBlock = false; @SubscribeEvent public void onClickTickEvent(TickEvent.ClientTickEvent event){ PlayerEntity player = Minecraft.getInstance().player; if(brokeMyBlock){ System.out.println("Sheared Block"); ObfuscationReflectionHelper.setPrivateValue(Minecraft.class, Minecraft.getInstance(), 0, "rightClickDelayTimer"); brokeMyBlock = false; } } @SubscribeEvent public void farmMyBlock(PlayerInteractEven
  16. Okay cool, I did the reflection straight in the PlayerInteractEvent.RightClickBlock method though, and everything's working A-Okay. Thanks for the help man. Here's my code for anyone that views this thread: Actual Method: @SubscribeEvent public void farmBlock(PlayerInteractEvent.RightClickBlock event) throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException { if(event.getPlayer().getHeldItem(event.getHand()).getItem().equals(Items.SHEARS) && event.getWorld().getBlockState(event.getPos()).equals(RegistryHandler.MY_BLOCK.get().getDefaultStat
  17. Okay, so I'll set Minecraft#rightClickDelayTimer to 0 through reflection, but won't this set the variable globally? Because TickEvent.ClientTickEvent doesn't have a "player" variable or "getPlayer()" method.
  18. Bug Fixed! Build: 1.16.1-32.0.55 - Mon Jul 06 21:12:45 GMT 2020 richard: Fix harvest level and tool type not actually getting set #6906 (#6922) Just make sure to keep .func_235861_h_() in the properties and your harvest levels and tool types will work like a charm. ๐Ÿ˜‰ Thanks Richard!
  19. Hey all, I'm trying to find a way to decrease the interval in which onItemUse() is fired on an item. For my application, I'm trying to increase the use time of my overwritten vanilla shears on a certain block that yields drops after you shear it. I want it to shear as fast as someone would punch out a bunch of tall grass. Here's my code in attempt to set the swinging time to zero when detecting the block being right clicked in the RightClickBlock event, sadly it doesn't work: @SubscribeEvent public void farmBlock(PlayerInteractEvent.RightClickBlock event) { if(e
  20. Darn. Well, at least I know what's causing it, thanks man. I guess the thread can stay open until its fixed? Or would that be necrobait? Or how does that work for things that don't have solutions at the moment, sorry I'm new here.
  21. Gotcha, I was able to utilize this and use tick() to check for surrounding blocks. This method is definitely a way to go for some actions, but unfortunately it didn't work for me, By putting this in onBlockPlace() and also putting it in tick(), I was able to make someone of a consistent tick loop that ran for every interval that the tick scheduler was set at. However, it was inconsistent as random ticks would overlap it and start new tick loops. Removing the tickRandomly() also wouldn't work for natural block appearances. Basically any solution using thi
  22. Fixed it. I have no clue why this fixes it but I added .func_235861_h_() to my properties list like so: public class MyBlock extends Block { public MyBlock() { super(Properties.create(Material.ROCK) .harvestTool(ToolType.PICKAXE) .harvestLevel(0) .hardnessAndResistance(1.5f, 6f) .sound(SoundType.STONE) .func_235861_h_() ); } } And now everything functions like it's supposed to. This is 1.16.1 by the way. Sorry for the unsupported version but hey, there ya go for anyone that has
×
×
  • Create New...

Important Information

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