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


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

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

<Gl33p_0r4nge>'s Achievements

Tree Puncher

Tree Puncher (2/8)



  1. yes I see now and I had it set correctly. Also my mod finally runs! Thanks for help
  2. How can i change the Java version for gradle? because it says when I run the command: Java: 1.8.0_162 JVM: 25.162-b12(Oracle Corporation) Arch: amd64
  3. Hi, I dont know why but apparently I cant run the mod at all. It worked few days ago but I dont remember what changes I did and not sure if that is the problem but heres what I got:
  4. Hi, so as the title says I would like to render text on side of a block. Something like sign do but when I looked through the code I cant seem to figure out what to do. Is there someone who have already did something like rendering text on a block?
  5. Hi I have one problem I dont know why but for some reason I cant change blockstate. Here is the LeadCoating.java: package me.gleep.oreganized.blocks; import me.gleep.oreganized.util.RegistryHandler; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.state.BooleanProperty; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.ToolType; import org.jetbrains.annotations.Nullable; import java.util.Random; public class LeadCoating extends Block { public static final int RANGE = 4; public static final IntegerProperty LEVEL = IntegerProperty.create("water_level", 0, 3); public static final IntegerProperty HEIGHT = IntegerProperty.create("base_height", 0, 255); public static final BooleanProperty IS_BASE = BooleanProperty.create("is_base"); public LeadCoating() { super(Properties.create(Material.IRON) .hardnessAndResistance(4.0F, 5.0F) .harvestTool(ToolType.PICKAXE) .setRequiresTool() .harvestLevel(1) .sound(SoundType.METAL)); this.setDefaultState(this.stateContainer.getBaseState().with(LEVEL, Integer.valueOf(0)).with(IS_BASE, false).with(HEIGHT, Integer.valueOf(0))); } /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { BlockPos basePos = pos.down(); while (worldIn.getBlockState(basePos).getBlock().equals(RegistryHandler.LEAD_COATING.get())) basePos = basePos.down(); basePos = basePos.up(); BlockPos topPos = basePos.up(); while (worldIn.getBlockState(topPos).getBlock().equals(RegistryHandler.LEAD_COATING.get())) { worldIn.setBlockState(topPos, worldIn.getBlockState(topPos).with(IS_BASE, false).with(HEIGHT, basePos.getY()), 2); topPos = topPos.up(); } topPos = topPos.down(); BlockState baseState = worldIn.getBlockState(basePos).with(IS_BASE, true).with(HEIGHT, topPos.getY()); worldIn.setBlockState(basePos, baseState, 2); } /** * Called after a player destroys this Block - the position pos may no longer hold the state indicated. */ @Override public void onPlayerDestroy(IWorld worldIn, BlockPos pos, BlockState state) { if (worldIn.getBlockState(pos.up()).getBlock().equals(RegistryHandler.LEAD_COATING.get())) { worldIn.getBlockState(pos.up()).getBlock().onBlockPlacedBy((World)worldIn, pos.up(), worldIn.getBlockState(pos.up()), null, ItemStack.EMPTY); } if (worldIn.getBlockState(pos.down()).getBlock().equals(RegistryHandler.LEAD_COATING.get())) { worldIn.getBlockState(pos.down()).getBlock().onBlockPlacedBy((World)worldIn, pos.down(), worldIn.getBlockState(pos.down()), null, ItemStack.EMPTY); } } @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(LEVEL).add(IS_BASE).add(HEIGHT); } @Override public boolean ticksRandomly(BlockState state) { return true; } /** * Performs a random tick on a block. */ @Override public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { this.tick(state, worldIn, pos, random); } @Override public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random rand) { if (state.get(IS_BASE) && state.get(LEVEL) == 3) { fertilize((World) worldIn, pos, state); } } @Override public void fillWithRain(World worldIn, BlockPos pos) { float f = worldIn.getBiome(pos).getTemperature(pos); if (!(f < 0.15F)) { BlockState state = worldIn.getBlockState(pos); BlockPos basePos = new BlockPos(pos.getX(), state.get(HEIGHT), pos.getZ()); BlockState baseState = worldIn.getBlockState(basePos); if (!flow(worldIn, basePos, baseState)) { worldIn.setBlockState(pos, state.with(LEVEL, Integer.valueOf(state.get(LEVEL) + 1))); } } } public void fertilize(World world, BlockPos pos, BlockState blockState) { int minY = pos.getY(); int maxY = blockState.get(HEIGHT); for (int i = minY; i <= maxY; i++) { int rndX = world.getRandom().nextInt(RANGE * 2) - 4; int rndZ = world.getRandom().nextInt(RANGE * 2) - 4; BlockPos pos1 = new BlockPos(pos.getX() + rndX, i - 1, pos.getZ() + rndZ); BlockState state1 = world.getBlockState(pos1); BlockPos leadPos = new BlockPos(pos.getX(), i, pos.getZ()); BlockState leadState = world.getBlockState(leadPos); for (int j = leadState.get(LEVEL); j > 0; j--) { if (state1.getBlock() instanceof IGrowable) { IGrowable igrowable = (IGrowable) state1.getBlock(); if (igrowable.canGrow(world, pos1, state1, world.isRemote)) { if (world instanceof ServerWorld) { if (igrowable.canUseBonemeal(world, world.rand, pos1, state1)) { igrowable.grow((ServerWorld) world, world.rand, pos1, state1); world.setBlockState(leadPos, leadState.with(LEVEL, Integer.valueOf(leadState.get(LEVEL) - 1)), 2); } } } } } } } public boolean flow(World world, BlockPos pos, BlockState blockState) { if (blockState.get(IS_BASE)) { if (pos.getY() > blockState.get(HEIGHT)) return false; if (world.getBlockState(pos).get(LEVEL) == 3) { return flow(world, pos.up(), blockState); } else { BlockState prevState = world.getBlockState(pos); world.setBlockState(pos, prevState.with(LEVEL, Integer.valueOf(prevState.get(LEVEL) + 1)), 2); return true; } } return false; } /** * @deprecated call via {@link BlockState#hasComparatorInputOverride()} whenever possible. Implementing/overriding * is fine. */ @Override public boolean hasComparatorInputOverride(BlockState state) { return true; } /** * @deprecated call via {@link IBlockState#getComparatorInputOverride(World, BlockPos)} whenever possible. * Implementing/overriding is fine. */ @Override public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { return blockState.get(LEVEL); } } The block has three properties: height (if is_base == true then its the height of the most top block in the pillar else its the height of the base block); is_base (if this is the base block); water_level (amount of water in the block); And the problem is that it change the water level of base block and the top block but I cant change the water level of the blocks between. So my guess is that i have something wrong in the flow function but I tried almost everything and it just doesnt work. EDIT: Well I found out that it always bonemeals the grass and that means it seemed to not work. Sorry for bothering.
  6. yes thanks now it works. But I have another problem it spawns but its not animated. it always spawns the first particle in the list EDIT: nevermind I solved it i just had to do it manualy in the tick. again thanks for help
  7. Hi I have a little problem. Im trying to replace potion particles with my custom. So I looked on how to do this. I have the Particle class: package me.gleep.oreganized.particles; import net.minecraft.client.particle.*; import net.minecraft.client.world.ClientWorld; import net.minecraft.particles.BasicParticleType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Random; public class DawnShineParticle extends SpriteTexturedParticle { private static final Random RANDOM = new Random(); private final IAnimatedSprite spriteWithAge; protected DawnShineParticle(ClientWorld world, double x, double y, double z, double motionX, double motionY, double motionZ, IAnimatedSprite spriteWithAge) { super(world, x, y, z, 0.5D - RANDOM.nextDouble(), motionY, 0.5D - RANDOM.nextDouble()); this.spriteWithAge = spriteWithAge; this.motionY *= (double)0.2F; if (motionX == 0.0D && motionZ == 0.0D) { this.motionX *= (double)0.1F; this.motionZ *= (double)0.1F; } this.particleScale *= 0.75F; this.maxAge = (int)(10.0D / (Math.random() * 0.8D + 0.2D)); this.canCollide = false; this.selectSpriteWithAge(spriteWithAge); } @NotNull @Override public IParticleRenderType getRenderType() { return IParticleRenderType.PARTICLE_SHEET_LIT; } public static class Factory implements IParticleFactory<BasicParticleType> { private final IAnimatedSprite spriteSet; public Factory(IAnimatedSprite spriteSet) { this.spriteSet = spriteSet; } @Nullable @Override public Particle makeParticle(BasicParticleType typeIn, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { return new DawnShineParticle(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet); } } } I have registered it: (I have other registrations in one class so I dont want to copy the whole class. If you want me to I can post it later) public static final RegistryObject<ParticleType<BasicParticleType>> DAWN_SHINE_PARTICLE = PARTICLES.register("dawn_shine", () -> new BasicParticleType(false)); and another registration which I dont clearly understand: private void doClientStuff(final FMLClientSetupEvent event) { Minecraft.getInstance().particles.registerFactory(RegistryHandler.DAWN_SHINE_PARTICLE.get(), DawnShineParticle.Factory::new); } Then I made inside assets/<modid>/particles dawn_shine.json: { "textures": [ "oreganized:dawn_shine_0", "oreganized:dawn_shine_1", "oreganized:dawn_shine_2", "oreganized:dawn_shine_3", "oreganized:dawn_shine_4", "oreganized:dawn_shine_5", "oreganized:dawn_shine_6", "oreganized:dawn_shine_7", "oreganized:dawn_shine_8", "oreganized:dawn_shine_9" ] } and place the textures in assets/<modid>/textures/particle : and got this error: [10:24:15] [Render thread/FATAL] [minecraft/Minecraft]: Reported exception thrown! net.minecraft.crash.ReportedException: Rendering overlay at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:499) ~[forge-1.16.4-35.1.5_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1002) ~[forge-1.16.4-35.1.5_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.4-35.1.5_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.4-35.1.5_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.4-35.1.5_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.6.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.6.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.4-35.1.5_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} Caused by: java.lang.IllegalStateException: Redundant texture list for particle oreganized:dawn_shine at net.minecraft.client.particle.ParticleManager.loadTextureLists(ParticleManager.java:217) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.particle.ParticleManager.lambda$null$0(ParticleManager.java:169) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1626) ~[?:1.8.0_162] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) ~[?:1.8.0_162] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1618) ~[?:1.8.0_162] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_162] {} at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_162] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) ~[?:1.8.0_162] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[?:1.8.0_162] {} Anyone know what happend? I really dont know
  8. Yes thanks it works now: BTW in console I got this: [09:44:59] [Render thread/ERROR] [minecraft/Util]: No data fixer registered for shrapnel_tnt is it something I should worry about?
  9. So I have the following: ShrapnelTNTEntity: package me.gleep.oreganized.entities; import me.gleep.oreganized.util.RegistryHandler; import net.minecraft.entity.*; import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.IPacket; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.network.play.server.SSpawnObjectPacket; import net.minecraft.particles.ParticleTypes; import net.minecraft.world.Explosion; import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; public class ShrapnelTNTEntity extends Entity { private static final DataParameter<Integer> FUSE = EntityDataManager.createKey(ShrapnelTNTEntity.class, DataSerializers.VARINT); @Nullable private LivingEntity tntPlacedBy; private int fuse = 100; public ShrapnelTNTEntity(EntityType<? extends ShrapnelTNTEntity> entityTypeIn, World worldIn) { super(entityTypeIn, worldIn); this.preventEntitySpawning = true; } public ShrapnelTNTEntity(World worldIn, double x, double y, double z, @Nullable LivingEntity igniter) { this(RegistryHandler.SHRAPNEL_TNT_ENTITY.get(), worldIn); this.setPosition(x, y, z); double d0 = worldIn.rand.nextDouble() * (double)((float)Math.PI * 2F); this.setMotion(-Math.sin(d0) * 0.02D, (double)0.2F, -Math.cos(d0) * 0.02D); this.setFuse(100); this.prevPosX = x; this.prevPosY = y; this.prevPosZ = z; this.tntPlacedBy = igniter; } public void tick() { if (!this.hasNoGravity()) { this.setMotion(this.getMotion().add(0.0D, -0.04D, 0.0D)); } this.move(MoverType.SELF, this.getMotion()); this.setMotion(this.getMotion().scale(0.98D)); if (this.onGround) { this.setMotion(this.getMotion().mul(0.7D, -0.5D, 0.7D)); } --this.fuse; if (this.fuse <= 0) { this.remove(); if (!this.world.isRemote) { this.explode(); } } else { this.func_233566_aG_(); if (this.world.isRemote) { this.world.addParticle(ParticleTypes.SMOKE, this.getPosX(), this.getPosY() + 0.5D, this.getPosZ(), 0.0D, 0.0D, 0.0D); } } } protected void explode() { this.world.createExplosion(this, this.getPosX(), this.getPosYHeight(0.0625D), this.getPosZ(), 3.0F, Explosion.Mode.BREAK); } public void setFuse(int fuseIn) { this.dataManager.set(FUSE, fuseIn); this.fuse = fuseIn; } @Override protected boolean canTriggerWalking() { return false; } @Override public boolean canBeCollidedWith() { return !this.isAlive(); } public int getFuse() { return this.fuse; } @Override protected float getEyeHeight(Pose poseIn, EntitySize sizeIn) { return 0.15F; } @Override public void notifyDataManagerChange(DataParameter<?> key) { if (FUSE.equals(key)) { this.fuse = this.getFuseDataManager(); } } public int getFuseDataManager() { return this.dataManager.get(FUSE); } @Nullable public LivingEntity getTntPlacedBy() { return this.tntPlacedBy; } @Override protected void registerData() { this.dataManager.register(FUSE, 100); } @Override protected void readAdditional(CompoundNBT compound) { this.setFuse(compound.getShort("Fuse")); } @Override protected void writeAdditional(CompoundNBT compound) { compound.putShort("Fuse", (short)this.getFuse()); } @NotNull @Override public IPacket<?> createSpawnPacket() { return new SSpawnObjectPacket(this); } } ShrapnelTNTRenderer: package me.gleep.oreganized.entities.entityrenderer; import com.mojang.blaze3d.matrix.MatrixStack; import me.gleep.oreganized.entities.ShrapnelTNTEntity; import me.gleep.oreganized.util.RegistryHandler; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.TNTMinecartRenderer; import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.client.registry.IRenderFactory; import org.jetbrains.annotations.NotNull; @OnlyIn(Dist.CLIENT) public class ShrapnelTNTRenderer extends EntityRenderer<ShrapnelTNTEntity> { public ShrapnelTNTRenderer(EntityRendererManager renderManagerIn) { super(renderManagerIn); this.shadowSize = 0.5F; } @Override public void render(ShrapnelTNTEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { matrixStackIn.push(); matrixStackIn.translate(0.0D, 0.5D, 0.0D); if ((float)entityIn.getFuse() - partialTicks + 1.0F < 10.0F) { float f = 1.0F - ((float)entityIn.getFuse() - partialTicks + 1.0F) / 10.0F; f = MathHelper.clamp(f, 0.0F, 1.0F); f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; matrixStackIn.scale(f1, f1, f1); } matrixStackIn.rotate(Vector3f.YP.rotationDegrees(-90.0F)); matrixStackIn.translate(-0.5D, -0.5D, 0.5D); matrixStackIn.rotate(Vector3f.YP.rotationDegrees(90.0F)); TNTMinecartRenderer.renderTntFlash(RegistryHandler.SHRAPNEL_TNT.get().getDefaultState(), matrixStackIn, bufferIn, packedLightIn, entityIn.getFuse() / 5 % 2 == 0); matrixStackIn.pop(); super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); } @NotNull @Override public ResourceLocation getEntityTexture(ShrapnelTNTEntity entity) { return AtlasTexture.LOCATION_BLOCKS_TEXTURE; } } RegistryHandler: package me.gleep.oreganized.util; import me.gleep.oreganized.Oreganized; import me.gleep.oreganized.armors.*; import me.gleep.oreganized.blocks.*; import me.gleep.oreganized.entities.LeadNuggetEntity; import me.gleep.oreganized.entities.ShrapnelTNTEntity; import me.gleep.oreganized.entities.tileentities.ExposerBlockTileEntity; import me.gleep.oreganized.effects.*; import me.gleep.oreganized.fluids.*; import me.gleep.oreganized.items.*; import me.gleep.oreganized.tools.*; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.client.gui.DisplayEffectsScreen; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityType; import net.minecraft.fluid.Fluid; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.*; import net.minecraft.potion.Effect; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ToolType; import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class RegistryHandler { public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, Oreganized.MOD_ID); public static void init() { ENTITIES.register(FMLJavaModLoadingContext.get().getModEventBus()); //... } public static final RegistryObject<EntityType<ShrapnelTNTEntity>> SHRAPNEL_TNT_ENTITY = ENTITIES.register("shrapnel_tnt", () -> EntityType.Builder.<ShrapnelTNTEntity>create( ShrapnelTNTEntity::new, EntityClassification.MISC ).immuneToFire().size(0.98F, 0.98F).trackingRange(10).func_233608_b_(10).build("shrapnel_tnt") ); } And the renderer registration: private void doClientStuff(final FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(RegistryHandler.SHRAPNEL_TNT_ENTITY.get(), ShrapnelTNTRenderer::new); } and the tnt itself works but the "exploding" entity does not render. I tried almost everything can anyone help me?
  10. Okay I see that no one probably know how but can you at least tell me where should I get the rendered player view?
  11. I have no idea how to do some screen rendering nor did something like this before. But I want to make something like nausea effect but little bit more than just portal effect. I want to do something that will get the actuall player view and make it flipped and mirror it and blend it with the players view so it will look something like this: And yes I want it to shake. plus I would like to render the particles like every effect should render. Thanks for any help
  12. Okay I know that what I did is horible but I look at it and rework it so now Im using the ObfuscationReflectionHelper and it works fine. But for the static final, I need to call it only once each time enitity spawns (or the world loads) so I think its not neccessary.
  13. OMG it works but not completly. It will probably be something with my code bcs I have never used predicates or reflections but I somehow managed to make it work (and Im proud of it 😆). So now I have problem with that when it is not "angry" on me and I have the armor its okay he don't even notice me but while he is targeting me and I equip the armor he is still following me and is trying to hit me. Here is the code: @SubscribeEvent public static void onEntityJoin(EntityJoinWorldEvent event){ if (event.getEntity().isLiving()) { LivingEntity living = (LivingEntity) event.getEntity(); if (living.isEntityUndead()) { MonsterEntity monster = (MonsterEntity) event.getEntity(); Field goalsField = null; try { goalsField = monster.targetSelector.getClass().getDeclaredField("goals"); goalsField.setAccessible(true); Set<PrioritizedGoal> goals = (Set<PrioritizedGoal>) goalsField.get(monster.targetSelector); for (PrioritizedGoal g : goals) { if (g.getGoal() instanceof NearestAttackableTargetGoal<?>){ NearestAttackableTargetGoal<?> goal = (NearestAttackableTargetGoal<?>) g.getGoal(); Field targetClassField = goal.getClass().getDeclaredField("targetClass"); targetClassField.setAccessible(true); Class<?> targetClass = (Class<?>) targetClassField.get(goal); if (targetClass == PlayerEntity.class || targetClass == ServerPlayerEntity.class) { Field targetESField = goal.getClass().getDeclaredField("targetEntitySelector"); targetESField.setAccessible(true); EntityPredicate targetEntitySelector = (EntityPredicate) targetESField.get(goal); targetEntitySelector.setCustomPredicate((target) -> { for (ItemStack itemStack : target.getArmorInventoryList()) { if (ItemTags.getCollection().getTagByID( new ResourceLocation("oreganized:silver_tinted_items")) .contains(itemStack.getItem())) return false; } return true; }); } } } } catch (NoSuchFieldException | IllegalAccessException noSuchFieldException) { noSuchFieldException.printStackTrace(); } } } } thanks for help!
  14. Hi maybe Im super dumb but I just cant find where to change/cancel what entity should be the mob attacking (I mean the thing when for example zombie follows you and attacks you) can someone tell me where can I find this and how to change the value to null or cancel the tracking? I just want to make mob neutral when Im wearing my custom mod armor. Thanks for any help.
  • Create New...

Important Information

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