RobinCirex
Members-
Posts
115 -
Joined
-
Last visited
Everything posted by RobinCirex
-
Hey, I'm trying to track the packets received. I can't find an event for that, so I tried overwriting the NetworkManager of Minecraft#getConnection The mod is a clientside mod. public void onSetup(FMLCommonSetupEvent event) { ObfuscationReflectionHelper.setPrivateValue(ClientPlayNetHandler.class, Minecraft.getInstance().getConnection(), new CustomNetworkHandler(PacketDirection.CLIENTBOUND), "field_147371_a"); } package me.cirex.ditzydisplay.clientchannel; import net.minecraft.network.IPacket; import net.minecraft.network.NetworkManager; import net.minecraft.network.PacketDirection; public class CustomNetworkHandler extends NetworkManager { public CustomNetworkHandler(PacketDirection packetDirection) { super(packetDirection); System.out.println("test"); } @Override public void sendPacket(IPacket<?> packetIn) { System.out.println("test"); super.sendPacket(packetIn); } @Override public void tick() { super.tick(); System.out.println("test"); } } This is my code. I don't get an errror, but I don't get any sysouts either
-
Hey, I'm working on a custom entity right now and for some reason, every fields I have added keep switching between 0 and their actual value. For example it has the field "temperature" and when sysouting the value I get this This isn't only for temperature 0.0 37.0 0.0 37.0 37.0 0.0 37.0 0.0 Does anyone know why this happens? I don't set it anywhere, except in the "readFromNBT" method but afaik that is only called on world spawn?
-
Okay, thank you, I ended up with changing the LivingHurtEvent
-
Hey, I'm trying to cancel the DeathEvent. "isCancellable" is true but when I cancel the event, the entity still dies as usual. Can someone tell me why / how I can actually cancel deaths?
-
oh, yea, that was a typo, but when setting it higher it still doesnt work
-
public float robotHealth = 2000; @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); ObfuscationReflectionHelper.setPrivateValue(RangedAttribute.class, (RangedAttribute) SharedMonsterAttributes.MAX_HEALTH, 1000, "field_111118_b"); this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(robotHealth); this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ATTACK_DAMAGE) .setBaseValue(this.attackDamage); }
-
It does the same thing as before. The health is outputted as "1.4E-45" and the mob is one hit
-
Oh yea, oops. Did it like this now and it still doesn't work. @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); ObfuscationReflectionHelper.setPrivateValue(RangedAttribute.class, (RangedAttribute) SharedMonsterAttributes.MAX_HEALTH, 1000, "field_111118_b"); this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(robotHealth); this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ATTACK_DAMAGE) .setBaseValue(this.attackDamage); }
-
Okay. Either way, here's my full code of the function. Apparently the field isn't found even though it should be the correct field @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); ObfuscationReflectionHelper.setPrivateValue(IAttribute.class, SharedMonsterAttributes.MAX_HEALTH, 1000, "field_111118_b"); this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(robotHealth); this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.ATTACK_DAMAGE) .setBaseValue(this.attackDamage); }
-
How else should I handle them?
-
try { ReflectionUtil.setFieldValue(SharedMonsterAttributes.MAX_HEALTH.getClass().getDeclaredField("maximumValue"), SharedMonsterAttributes.MAX_HEALTH, 100000); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(robotHealth); //robotHealth = 2000
-
Hey, so I have tried this now and set the maximum health to 2000. When I sysout getHealth() now it outputs this, the mob is also one hit. Do you know why?
-
thanks
-
Hey so, the MAX_HEALTH has a max value of 1024 and I'm wondering if there is a way to change that
-
[1.15.2] FlowingFluidBlock onUpdate method
RobinCirex replied to RobinCirex's topic in Modder Support
thanks -
[1.15.2] FlowingFluidBlock onUpdate method
RobinCirex replied to RobinCirex's topic in Modder Support
I have another question now: Can you tell me what you put in as properties? -
[1.15.2] FlowingFluidBlock onUpdate method
RobinCirex replied to RobinCirex's topic in Modder Support
Yea okay, I found the difference now. You overwrote the fluid, not the block. I'm gonna try that too, thanks for your help -
[1.15.2] FlowingFluidBlock onUpdate method
RobinCirex replied to RobinCirex's topic in Modder Support
Okay.. thank you What version is this? -
[1.15.2] FlowingFluidBlock onUpdate method
RobinCirex replied to RobinCirex's topic in Modder Support
Does anyone have an answer to this? -
[1.15.2] FlowingFluidBlock onUpdate method
RobinCirex replied to RobinCirex's topic in Modder Support
Yea, I am, weird. Did you try it with a FlowingFluidBlock? -
Hey, I'm trying to edit water at the moment and I'm looking for a method that is constantly called on the serverside. The method "tick" isn't called at all.
-
Overriding a block in the registry. [1.15.2]
RobinCirex replied to RobinCirex's topic in Modder Support
14:43:50] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid erosionmod java.lang.ClassCastException: me.cirex.erosionmod.CustomFlowingFluidBlock cannot be cast to net.minecraft.item.Item at net.minecraftforge.registries.GameData$ItemCallbacks.onAdd(GameData.java:494) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:376) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:308) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:133) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at me.cirex.erosionmod.ErosionMod.onRegister(ErosionMod.java:64) ~[main/:?] {re:classloading} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:31.1] {re:classloading} at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_202] {} at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_202] {} at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$5(ModList.java:125) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_202] {} at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModList.lambda$static$1(ModList.java:96) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$24(ModLoader.java:189) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:972) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$2(ClientModLoader.java:97) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$5(ClientModLoader.java:113) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.<init>(Minecraft.java:398) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:141) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_202] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_202] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102) [forge-1.15.2-31.1.19_mapped_snapshot_20200225-1.15.1-recomp.jar:?] {} This is the full error. Line 64 is the line where I register the block. I don't know why it tries to cast it to an item though -
Overriding a block in the registry. [1.15.2]
RobinCirex replied to RobinCirex's topic in Modder Support
Okay. Is this correct? I get this error for some reason now java.lang.ClassCastException: me.cirex.erosionmod.CustomFlowingFluidBlock cannot be cast to net.minecraft.item.Item @SubscribeEvent public void onRegister(RegistryEvent.Register<Block> event) { event.getRegistry().register(new CustomFlowingFluidBlock(Fluids.WATER, Block.Properties.create(Material.WATER).doesNotBlockMovement().hardnessAndResistance(100.0F).noDrops()) .setRegistryName("minecraft", "water")); } -
Hey, I'm trying to override a block but when booting up the game I get this error Registry Block: Override did not have an associated owner object. Name: minecraft:water Value: Block{minecraft:water} this is my code public static final Block WATER = register("water", new CustomFlowingFluidBlock(Fluids.WATER, Block.Properties.create(Material.WATER).doesNotBlockMovement().hardnessAndResistance(100.0F).noDrops())); private static Block register(String key, Block p_222382_1_) { return Registry.register(Registry.BLOCK, key, p_222382_1_); }
-
Thanks