Jump to content

<Gl33p_0r4nge>

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by <Gl33p_0r4nge>

  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. Im using the forge launcher in IntelliJ IDEA
  4. 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:
  5. 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?
  6. 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.
  7. 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
  8. 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
  9. 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?
  10. 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?
  11. Okay I see that no one probably know how but can you at least tell me where should I get the rendered player view?
  12. 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
  13. 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.
  14. 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!
  15. 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.
  16. Nice now it is working that when I right click it changes to my cauldron and when I get the item out again by right clicking with bare hand it pops out and changing back to the vanilla cauldron. And my question is how can I check for source of fire under the cauldron (I maybe have idea just when event is fired on block (campfire) is placed) and how to change the content of the cauldron after some ticks (I have never worked with ticks and other related stuff)?
  17. Like if I put in lead block (which is from my mod) then put campfire/some source of fire under it, it melts. Like water it will have 3 "levels" that means that it will change texture from basic block to melted stage and to completly melted then the player could get it from the cauldron with bucket recieving lead bucket which I haven't created yet and tbh maybe you right about it not overriding the cauldron because with this I override the water colors which is controlled somwhere else as I guess.
  18. But I need interaction so I think It's better for me to create new Cauldron
  19. I looked in the forum and yeah it looks like forge really dont like overriding vanilla items/blocks with custom block states so I need to create my cauldron anyway: [10:22:41] [Render thread/ERROR] [ne.mi.re.GameData/REGISTRIES]: Registry replacements for vanilla block 'minecraft:cauldron' must not change the number or order of blockstates. Old: level={0,1,2,3} New: content={0,1,2};level={0,1,2,3} but still happy that I made it like this so it could actually work. Maybe in 1.17 there will be more support to adding custom fluids to cauldron as they add lava and other to cauldron Anyways thanks for help! for those who want to do the same thing as I want just simply do this (its just replacing the cauldron with your own cauldron when placed) : public class VanillaCauldron extends CauldronBlock { public VanillaCauldron() { super(AbstractBlock.Properties.create(Material.IRON, MaterialColor.STONE).setRequiresTool().hardnessAndResistance(2.0F).notSolid()); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { if (!worldIn.isRemote) { worldIn.removeBlock(pos, false); worldIn.setBlockState(pos, RegistryHandler.CAULDRON.get().getDefaultState()); } } } You want there put your registry class and the new name of the block (mine is CAULDRON): worldIn.setBlockState(pos, RegistryHandler.CAULDRON.get().getDefaultState()); then register it in registry like normal block except your modid replace with "minecraft" and then create your block also extending the vanilla one and here you can override add custom blockstatest as you wish and want. Then simply register it as block under your modid and there you go. Also dont forget to create json files EDIT: oh no Im dumb do this with the Cauldron Item then check when right click EDIT 2: wait just still testing it Yeah I was wrong just simply dont override it and with the BlockEvent.EntityPlaceEvent check for cauldron block
  20. ohhh, allright now I understatnd thats Registry: package me.gleep.oreexpansion.util; import me.gleep.oreexpansion.OreExpansion; import me.gleep.oreexpansion.armors.STAMaterial; import me.gleep.oreexpansion.armors.ArmorBase; import me.gleep.oreexpansion.blocks.*; import me.gleep.oreexpansion.blocks.tileentities.SilverBlockTileEntity; import me.gleep.oreexpansion.items.ItemBase; import me.gleep.oreexpansion.tools.STSMaterial; import me.gleep.oreexpansion.tools.STSBase; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.*; import net.minecraft.tileentity.TileEntityType; import net.minecraft.world.gen.blockstateprovider.BlockStateProviderType; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class RegistryHandler { //Vanilla private static final DeferredRegister<Block> VANILLA_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft"); //Mod private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, OreExpansion.MOD_ID); private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, OreExpansion.MOD_ID); //private static final DeferredRegister<Fluid> FLUDIS = DeferredRegister.create(ForgeRegistries.FLUIDS, OreExpansion.MOD_ID); private static final DeferredRegister<TileEntityType<?>> TILE_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, OreExpansion.MOD_ID); //private static final DeferredRegister<IRecipeSerializer<?>> RECIPES = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, OreExpansion.MOD_ID); public static void init() { ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); //FLUDIS.register(FMLJavaModLoadingContext.get().getModEventBus()); TILE_ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); VANILLA_BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); } //Items public static final RegistryObject<Item> SILVER_INGOT = ITEMS.register("silver_ingot", ItemBase::new); public static final RegistryObject<Item> LEAD_INGOT = ITEMS.register("lead_ingot", ItemBase::new); public static final RegistryObject<Item> SILVER_NUGGET = ITEMS.register("silver_nugget", ItemBase::new); public static final RegistryObject<Item> LEAD_NUGGET = ITEMS.register("lead_nugget", ItemBase::new); public static final RegistryObject<Item> NETHERITE_NUGGET = ITEMS.register("netherite_nugget", () -> new ItemBase(true)); //public static final RegistryObject<Item> LEAD_BUCKET = ITEMS.register("lead_bucket", LeadBucket::new); //Blocks public static final RegistryObject<Block> SILVER_BLOCK = BLOCKS.register("silver_block", SilverBlock::new); public static final RegistryObject<Block> LEAD_BLOCK = BLOCKS.register("lead_block", LeadBlock::new); public static final RegistryObject<Block> SILVER_ORE = BLOCKS.register("silver_ore", SilverOre::new); public static final RegistryObject<Block> LEAD_ORE = BLOCKS.register("lead_ore", LeadOre::new); public static final RegistryObject<Block> CAULDRON = VANILLA_BLOCKS.register("cauldron", Cauldron::new); //Block Item public static final RegistryObject<Item> SILVER_BLOCK_ITEM = ITEMS.register("silver_block", () -> new BlockItemBase(SILVER_BLOCK.get())); public static final RegistryObject<Item> LEAD_BLOCK_ITEM = ITEMS.register("lead_block", () -> new BlockItemBase(LEAD_BLOCK.get())); public static final RegistryObject<Item> SILVER_ORE_ITEM = ITEMS.register("silver_ore", () -> new BlockItemBase(SILVER_ORE.get())); public static final RegistryObject<Item> LEAD_ORE_ITEM = ITEMS.register("lead_ore", () -> new BlockItemBase(LEAD_ORE.get())); //Fluids //public static final RegistryObject<FlowingFluidBlock> LEAD_FLUID = FLUDIS.register("lead_fluid", (); //Tile Entities public static final RegistryObject<TileEntityType<SilverBlockTileEntity>> SILVER_BLOCK_TE = TILE_ENTITY_TYPES.register("silver_block", () -> TileEntityType.Builder.create( SilverBlockTileEntity::new, SILVER_BLOCK.get()).build(null)); //Tools public static final RegistryObject<SwordItem> SILVER_TINTED_GOLDEN_SWORD = ITEMS.register("silver_tinted_golden_sword", () -> new STSBase(STSMaterial.STGS, 3, -2.4F)); public static final RegistryObject<SwordItem> SILVER_TINTED_DIAMOND_SWORD = ITEMS.register("silver_tinted_diamond_sword", () -> new STSBase(STSMaterial.STDS, 3, -2.4F)); public static final RegistryObject<SwordItem> SILVER_TINTED_NETHERITE_SWORD = ITEMS.register("silver_tinted_netherite_sword", () -> new STSBase(STSMaterial.STNS, 3, -2.4F, true)); //Armors public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_HELMET = ITEMS.register("silver_tinted_golden_helmet", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.HEAD)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_CHESTPLATE = ITEMS.register("silver_tinted_golden_chestplate", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.CHEST)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_LEGGINGS = ITEMS.register("silver_tinted_golden_leggings", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.LEGS)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_BOOTS = ITEMS.register("silver_tinted_golden_boots", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.FEET)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_HELMET = ITEMS.register("silver_tinted_diamond_helmet", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.HEAD)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_CHESTPLATE = ITEMS.register("silver_tinted_diamond_chestplate", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.CHEST)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_LEGGINGS = ITEMS.register("silver_tinted_diamond_leggings", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.LEGS)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_BOOTS = ITEMS.register("silver_tinted_diamond_boots", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.FEET)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_HELMET = ITEMS.register("silver_tinted_netherite_helmet", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.HEAD, true)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_CHESTPLATE = ITEMS.register("silver_tinted_netherite_chestplate", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.CHEST, true)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_LEGGINGS = ITEMS.register("silver_tinted_netherite_leggings", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.LEGS, true)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_BOOTS = ITEMS.register("silver_tinted_netherite_boots", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.FEET, true)); } like I haven't made change since I'm editing the cauldron and the main: package me.gleep.oreexpansion; import me.gleep.oreexpansion.util.RegistryHandler; import me.gleep.oreexpansion.world.gen.CustomOreGen; import net.minecraft.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod("oreexpansion") public class OreExpansion { private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "oreexpansion"; public OreExpansion() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); RegistryHandler.init(); } private void setup(final FMLCommonSetupEvent event) { CustomOreGen.registerOres(); MinecraftForge.EVENT_BUS.register(this); LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } }
  21. Okay so, I tried this in the constructor (the second line is what I tried first): this.setDefaultState(this.getDefaultState().with(LEVEL, Integer.valueOf(0)).with(CONTENT, Integer.valueOf(0))); this.setDefaultState(this.stateContainer.getBaseState().with(CONTENT, Integer.valueOf(0)).with(LEVEL, Integer.valueOf(0))); And I still got the same error: I tried it without that 2 methods with one of them and still don't working. I don't know if I mention that but I'm registring it as vanilla block. It was working before I start to deal with block states. And also Im creating new cauldron.json in texturepacks but thats not the main problem I think because it runs without textures. I know I just forgot to remove it before posting. It is not always 0 it stores the material in the cauldron
  22. So I'm trying to override/recreate vanilla cauldron's mechanic. I end up with this... My Cauldron Code: package me.gleep.oreexpansion.blocks; import me.gleep.oreexpansion.util.RegistryHandler; import me.gleep.oreexpansion.util.CustomBlockStatePropeties; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.*; import net.minecraft.potion.PotionUtils; import net.minecraft.potion.Potions; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer; import net.minecraft.stats.Stats; import net.minecraft.tileentity.BannerTileEntity; import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class Cauldron extends CauldronBlock { public static final IntegerProperty CONTENT = CustomBlockStatePropeties.CONTENTS_0_2; public Cauldron() { super(AbstractBlock.Properties.create(Material.IRON, MaterialColor.STONE).setRequiresTool().hardnessAndResistance(2.0F).notSolid()); } @Override public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { ItemStack itemstack = player.getHeldItem(handIn); if (itemstack.isEmpty()) { return ActionResultType.PASS; } else { int i = state.get(LEVEL); int j = state.get(CONTENT); Item item = itemstack.getItem(); if (item == RegistryHandler.LEAD_BLOCK_ITEM.get()) { if (!worldIn.isRemote && j == 0) { /*if (!player.abilities.isCreativeMode) { player.setHeldItem(handIn, new ItemStack(Items.BUCKET)); }*/ player.addStat(Stats.FILL_CAULDRON); this.setInside(worldIn, pos, state, 2); this.setLeadLevel(worldIn, pos, state, 1); worldIn.playSound((PlayerEntity) null, pos, SoundEvents.BLOCK_STONE_BREAK, SoundCategory.BLOCKS, 1.0F, 1.0F); } return ActionResultType.func_233537_a_(worldIn.isRemote); } /*else if (item == RegistryHandler.LEAD_BUCKET.get()) { if (j == 0 && i < 3 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { player.setHeldItem(handIn, new ItemStack(Items.BUCKET)); } player.addStat(Stats.FILL_CAULDRON); this.setInside(worldIn, pos, state, 0); this.setLeadLevel(worldIn, pos, state, 0); worldIn.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_BUCKET_EMPTY_LAVA, SoundCategory.BLOCKS, 1.0F, 1.0F); } return ActionResultType.func_233537_a_(worldIn.isRemote); }*/ else if (item == Items.WATER_BUCKET) { if (j < 2 && i < 3 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { player.setHeldItem(handIn, new ItemStack(Items.BUCKET)); } player.addStat(Stats.FILL_CAULDRON); this.setInside(worldIn, pos, state, 1); this.setWaterLevel(worldIn, pos, state, 3); worldIn.playSound((PlayerEntity) null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); } return ActionResultType.func_233537_a_(worldIn.isRemote); } else if (item == Items.BUCKET) { if (j > 0 && i == 3 && !worldIn.isRemote) { if (j == 1) { if (!player.abilities.isCreativeMode) { itemstack.shrink(1); if (itemstack.isEmpty()) { player.setHeldItem(handIn, new ItemStack(Items.WATER_BUCKET)); } else if (!player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET))) { player.dropItem(new ItemStack(Items.WATER_BUCKET), false); } } player.addStat(Stats.USE_CAULDRON); this.setInside(worldIn, pos, state, 0); this.setWaterLevel(worldIn, pos, state, 0); worldIn.playSound((PlayerEntity) null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); } else { return ActionResultType.PASS; /*if (!player.abilities.isCreativeMode) { itemstack.shrink(1); if (itemstack.isEmpty()) { player.setHeldItem(handIn, new ItemStack(Items.WATER_BUCKET)); } else if (!player.inventory.addItemStackToInventory(new ItemStack(Items.WATER_BUCKET))) { player.dropItem(new ItemStack(Items.WATER_BUCKET), false); } } player.addStat(Stats.USE_CAULDRON); this.setInside(worldIn, pos, state, 0); this.setWaterLevel(worldIn, pos, state, 0); worldIn.playSound((PlayerEntity) null, pos, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.BLOCKS, 1.0F, 1.0F);*/ } } return ActionResultType.func_233537_a_(worldIn.isRemote); } else if (item == Items.GLASS_BOTTLE) { if (j == 1 && i > 0 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { ItemStack itemstack4 = PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER); player.addStat(Stats.USE_CAULDRON); itemstack.shrink(1); if (itemstack.isEmpty()) { player.setHeldItem(handIn, itemstack4); } else if (!player.inventory.addItemStackToInventory(itemstack4)) { player.dropItem(itemstack4, false); } else if (player instanceof ServerPlayerEntity) { ((ServerPlayerEntity) player).sendContainerToPlayer(player.container); } } worldIn.playSound((PlayerEntity) null, pos, SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); if (i - 1 == 0) this.setInside(worldIn, pos, state, 0); this.setWaterLevel(worldIn, pos, state, i - 1); } return ActionResultType.func_233537_a_(worldIn.isRemote); } else if (item == Items.POTION && PotionUtils.getPotionFromItem(itemstack) == Potions.WATER) { if (j < 2 && i < 3 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { ItemStack itemstack3 = new ItemStack(Items.GLASS_BOTTLE); player.addStat(Stats.USE_CAULDRON); player.setHeldItem(handIn, itemstack3); if (player instanceof ServerPlayerEntity) { ((ServerPlayerEntity) player).sendContainerToPlayer(player.container); } } worldIn.playSound((PlayerEntity) null, pos, SoundEvents.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); this.setWaterLevel(worldIn, pos, state, i + 1); } return ActionResultType.func_233537_a_(worldIn.isRemote); } else { if (j == 1) { if (i > 0 && item instanceof IDyeableArmorItem) { IDyeableArmorItem idyeablearmoritem = (IDyeableArmorItem) item; if (idyeablearmoritem.hasColor(itemstack) && !worldIn.isRemote) { idyeablearmoritem.removeColor(itemstack); if (i - 1 == 0) this.setInside(worldIn, pos, state, 0); this.setWaterLevel(worldIn, pos, state, i - 1); player.addStat(Stats.CLEAN_ARMOR); return ActionResultType.SUCCESS; } } else if (i > 0 && item instanceof BannerItem) { if (BannerTileEntity.getPatterns(itemstack) > 0 && !worldIn.isRemote) { ItemStack itemstack2 = itemstack.copy(); itemstack2.setCount(1); BannerTileEntity.removeBannerData(itemstack2); player.addStat(Stats.CLEAN_BANNER); if (!player.abilities.isCreativeMode) { itemstack.shrink(1); this.setWaterLevel(worldIn, pos, state, i - 1); } if (itemstack.isEmpty()) { player.setHeldItem(handIn, itemstack2); } else if (!player.inventory.addItemStackToInventory(itemstack2)) { player.dropItem(itemstack2, false); } else if (player instanceof ServerPlayerEntity) { ((ServerPlayerEntity) player).sendContainerToPlayer(player.container); } } return ActionResultType.func_233537_a_(worldIn.isRemote); } else if (i > 0 && item instanceof BlockItem) { Block block = ((BlockItem) item).getBlock(); if (block instanceof ShulkerBoxBlock && !worldIn.isRemote()) { ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX, 1); if (itemstack.hasTag()) { itemstack1.setTag(itemstack.getTag().copy()); } player.setHeldItem(handIn, itemstack1); this.setWaterLevel(worldIn, pos, state, i - 1); player.addStat(Stats.CLEAN_SHULKER_BOX); return ActionResultType.SUCCESS; } else { return ActionResultType.CONSUME; } } else return ActionResultType.PASS; } } } return ActionResultType.PASS; } public void setInside(World worldIn, BlockPos pos, BlockState state, int content) { worldIn.setBlockState(pos, state.with(CONTENT, Integer.valueOf(MathHelper.clamp(content, 0, 2))), 2); } public void setLeadLevel(World worldIn, BlockPos pos, BlockState state, int level) { worldIn.setBlockState(pos, state.with(LEVEL, Integer.valueOf(MathHelper.clamp(level, 0, 3))), 2); } @Override public void fillWithRain(World worldIn, BlockPos pos) { if (worldIn.getBlockState(pos).get(CONTENT) < 2) { super.fillWithRain(worldIn, pos); } } } and something I hoped that will work: package me.gleep.oreexpansion.util; import net.minecraft.state.IntegerProperty; import net.minecraft.state.properties.BlockStateProperties; public class CustomBlockStatePropeties extends BlockStateProperties { public static final IntegerProperty CONTENTS_0_2 = IntegerProperty.create("content", 0, 2); } It worked but I wanted to add textures and I ran into a problem. I need apparently add custom block state so I added thisto the Cauldron code: @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { super.fillStateContainer(builder); builder.add(CONTENT); } @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(CONTENT, 0).getBlockState(); } And end up with error: ---- Minecraft Crash Report ---- // Daisy, daisy... Time: 3.12.20 14:17 Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:188) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:513) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.util.Util.acceptOrElse(Util.java:323) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:509) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.gui.ResourceLoadProgressGui.render(ResourceLoadProgressGui.java:113) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:492) ~[forge-1.16.4-35.1.2_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.2_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.2_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.2_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.2_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.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:455) ~[?:?] {re:classloading} -- MOD oreexpansion -- Details: Mod File: main Failure message: Ore Expansion (oreexpansion) encountered an error during the load_registries event phase java.lang.RuntimeException: Invalid vanilla replacement. See log for details. Mod Version: 1.16.4-0.0.1-alpha Mod Issue URL: http://my.issue.tracker/ Exception message: java.lang.RuntimeException: Invalid vanilla replacement. See log for details. Stacktrace: at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:455) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:425) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:404) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:335) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:142) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:200) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.DeferredRegister.access$000(DeferredRegister.java:61) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:172) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.eventbus.ASMEventHandler_0_EventDispatcher_handleEvent_Register.invoke(.dynamic) ~[?:?] {} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-3.0.5-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:297) ~[eventbus-3.0.5-service.jar:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:35.1] {re:classloading} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626) ~[?:1.8.0_162] {} at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:56) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:40) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:243) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:230) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:196) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$1(ClientModLoader.java:103) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:123) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:103) ~[forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.<init>(Minecraft.java:442) ~[forge-1.16.4-35.1.2_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:149) ~[forge-1.16.4-35.1.2_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.2_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.2_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} -- System Details -- Details: Minecraft Version: 1.16.4 Minecraft Version ID: 1.16.4 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_162, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 1359560424 bytes (1296 MB) / 1725956096 bytes (1646 MB) up to 3817865216 bytes (3641 MB) CPUs: 4 JVM Flags: 2 total; -Xmx4G -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump ModLauncher: 8.0.6+85+master.325de55 ModLauncher launch target: fmluserdevclient ModLauncher naming: mcp ModLauncher services: /mixin-0.8.2.jar mixin PLUGINSERVICE /eventbus-3.0.5-service.jar eventbus PLUGINSERVICE /forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-2.2.0-shadowed.jar accesstransformer PLUGINSERVICE /forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-launcher.jar runtimedistcleaner PLUGINSERVICE /mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE /forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.3-launcher.jar fml TRANSFORMATIONSERVICE FML: 35.1 Forge: net.minecraftforge:35.1.2 FML Language Providers: javafml@35.1 minecraft@1 Mod List: client-extra.jar |Minecraft |minecraft |1.16.4 |COMMON_SET|a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f main |Ore Expansion |oreexpansion |1.16.4-0.0.1-alpha |VALIDATE |NOSIGNATURE forge-1.16.4-35.1.2_mapped_snapshot_20201028-1.16.|Forge |forge |35.1.0 |COMMON_SET|NOSIGNATURE Crash Report UUID: edc69e6a-8785-4dfb-9c50-38b392e2f432 My question is if I could and how to make my custom block states or if I theres some other way or I made something wrong?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.