Posted September 27, 20196 yr So in my mod, there are Termite nests that grow upwards and outwards, and I want them to have different textures as the nests grow older. to do that I did this: Spoiler Spoiler { "variants": { "age=0": { "model": "extrablocks:block/termite_nestl0" }, "age=1": { "model": "extrablocks:block/termite_nestl0" }, "age=2": { "model": "extrablocks:block/termite_nestl0" }, "age=3": { "model": "extrablocks:block/termite_nestl1" }, "age=4": { "model": "extrablocks:block/termite_nestl1" }, "age=5": { "model": "extrablocks:block/termite_nestl1" }, "age=6": { "model": "extrablocks:block/termite_nestl1" }, "age=7": { "model": "extrablocks:block/termite_nestl2" }, "age=8": { "model": "extrablocks:block/termite_nestl2" }, "age=9": { "model": "extrablocks:block/termite_nestl2" }, "age=10": { "model": "extrablocks:block/termite_nestl2" }, "age=11": { "model": "extrablocks:block/termite_nestl2" }, "age=12": { "model": "extrablocks:block/termite_nestl2" }, "age=13": { "model": "extrablocks:block/termite_nestl2" }, "age=14": { "model": "extrablocks:block/termite_nestl2" }, "age=15": { "model": "extrablocks:block/termite_nestl2" } } } but that did not work (before you ask the block models are referring to actual pictures). and there doesn't seem to be anything wrong with my java file: Spoiler Spoiler package com.runningmanstudios.extrablocks.blocks; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.*; import net.minecraft.particles.ParticleTypes; import net.minecraft.pathfinding.PathType; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.*; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import java.util.Random; import static com.runningmanstudios.extrablocks.items.ModItems.TERMITE; public class TermiteNest extends Block implements net.minecraftforge.common.IPlantable { public static final DamageSource TERMITEDAMAGE = new DamageSource("termite"); public static final IntegerProperty AGE = BlockStateProperties.AGE_0_15; public TermiteNest() { super(Properties.create(Material.CACTUS) .tickRandomly() .hardnessAndResistance(0.4F) .sound(SoundType.CLOTH) ); this.setDefaultState(this.stateContainer.getBaseState().with(AGE, Integer.valueOf(0))); setRegistryName("termite_nest"); } public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { if (!worldIn.isAreaLoaded(pos, 1)) return; // Forge: prevent growing cactus from loading unloaded chunks with block update if (!state.isValidPosition(worldIn, pos)) { worldIn.destroyBlock(pos, true); } else { BlockPos blockposup = pos.up(); BlockPos blockposeast = pos.east(); BlockPos blockposwest = pos.west(); if (worldIn.isAirBlock(blockposup)) { int i; for(i = 1; worldIn.getBlockState(pos.down(i)).getBlock() == this; ++i) { ; } if (i < 3) { int j = state.get(AGE); if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, blockposup, state, true)) { if (j == 15) { worldIn.setBlockState(blockposup, this.getDefaultState()); BlockState blockstate = state.with(AGE, Integer.valueOf(0)); worldIn.setBlockState(pos, blockstate, 4); blockstate.neighborChanged(worldIn, blockposup, this, pos, false); } else { worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(j + 1)), 4); } net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state); } } } if (worldIn.isAirBlock(blockposeast)) { int i; for(i = 1; worldIn.getBlockState(pos.west(i)).getBlock() == this; ++i) { ; } if (i < 2) { int j = state.get(AGE); if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, blockposeast, state, true)) { if (j == 15) { worldIn.setBlockState(blockposeast, this.getDefaultState()); BlockState blockstate = state.with(AGE, Integer.valueOf(0)); worldIn.setBlockState(pos, blockstate, 4); blockstate.neighborChanged(worldIn, blockposeast, this, pos, false); } else { worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(j + 1)), 4); } net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state); } } } if (worldIn.isAirBlock(blockposwest)) { int i; for(i = 1; worldIn.getBlockState(pos.east(i)).getBlock() == this; ++i) { ; } if (i < 3) { int j = state.get(AGE); if(net.minecraftforge.common.ForgeHooks.onCropsGrowPre(worldIn, blockposwest, state, true)) { if (j == 15) { worldIn.setBlockState(blockposwest, this.getDefaultState()); BlockState blockstate = state.with(AGE, Integer.valueOf(0)); worldIn.setBlockState(pos, blockstate, 4); blockstate.neighborChanged(worldIn, blockposwest, this, pos, false); } else { worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(j + 1)), 4); } net.minecraftforge.common.ForgeHooks.onCropsGrowPost(worldIn, pos, state); } } } } } public boolean isSolid(BlockState state) { return true; } public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { ItemStack itemstack = player.getHeldItem(handIn); if (itemstack.isEmpty()) { return true; } else { int i = state.get(AGE); Item item = itemstack.getItem(); if (item == Items.WOODEN_HOE || item == Items.STONE_HOE || item == Items.IRON_HOE || item == Items.GOLDEN_HOE || item == Items.DIAMOND_HOE) { if (i > 3 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { itemstack.shrink(1); if (itemstack.isEmpty()) { player.setHeldItem(handIn, new ItemStack(TERMITE)); } else if (!player.inventory.addItemStackToInventory(new ItemStack(TERMITE))) { player.dropItem(new ItemStack(TERMITE), false); } } this.setAgeLevel(worldIn, pos, state, 0); worldIn.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F); } return true; } else { return false; } } } /** * Update the provided state given the provided neighbor facing and neighbor state, returning a new state. * For example, fences make their connections to the passed in state if possible, and wet concrete powder immediately * returns its solidified counterpart. * Note that this method should ideally consider only the specific face passed in. */ public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { if (!stateIn.isValidPosition(worldIn, currentPos)) { worldIn.getPendingBlockTicks().scheduleTick(currentPos, this, 1); } return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos); } @OnlyIn(Dist.CLIENT) public void animateTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { VoxelShape voxelshape = this.getShape(stateIn, worldIn, pos, ISelectionContext.dummy()); Vec3d vec3d = voxelshape.getBoundingBox().getCenter(); double d0 = (double)pos.getX() + vec3d.x; double d1 = (double)pos.getZ() + vec3d.z; for(int i = 0; i < 3; ++i) { if (rand.nextBoolean()) { worldIn.addParticle(ParticleTypes.SMOKE, d0 + (double)(rand.nextFloat() / 5.0F), (double)pos.getY() + (0.5D - (double)rand.nextFloat()), d1 + (double)(rand.nextFloat() / 5.0F), 0.0D, 0.0D, 0.0D); } } } public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { if (!entityIn.isImmuneToFire() && entityIn instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)entityIn)) { entityIn.attackEntityFrom(TERMITEDAMAGE, 1.0F); } super.onEntityWalk(worldIn, pos, entityIn); } /** * Gets the render layer this block will render on. SOLID for solid blocks, CUTOUT or CUTOUT_MIPPED for on-off * transparency (glass, reeds), TRANSLUCENT for fully blended transparency (stained glass) */ protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(AGE); } public boolean allowsMovement(BlockState state, IBlockReader worldIn, BlockPos pos, PathType type) { return false; } @Override public BlockState getPlant(IBlockReader world, BlockPos pos) { return getDefaultState(); } public void setAgeLevel(World worldIn, BlockPos pos, BlockState state, int level) { worldIn.setBlockState(pos, state.with(AGE, Integer.valueOf(MathHelper.clamp(level, 0, 3))), 2); worldIn.updateComparatorOutputLevel(pos, this); } } so could someone help me? Edited September 27, 20196 yr by MrNoodles75
September 27, 20196 yr What do you keep doing that makes your spoilers have 3000 pixels of pointless whitespace in them? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
September 27, 20196 yr Author 41 minutes ago, Draco18s said: What do you keep doing that makes your spoilers have 3000 pixels of pointless whitespace in them? @Draco18s if you could tell me I would be happy. it seems the larger the text I paste into the spoiler the more whitespace there is, maybe it is that I am pasting it straight from IntelliJ
September 27, 20196 yr 36 minutes ago, MrNoodles75 said: maybe it is that I am pasting it straight from IntelliJ Its been suggested that it's a Rich Text issue. Try pasting and then clicking the Tx button with it all selected. I believe the forum also pops up a little notification when you paste if you want to paste as plain text. Edited September 27, 20196 yr by Draco18s Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
September 27, 20196 yr Author 4 minutes ago, Draco18s said: Its been suggested that it's a Rich Text issue. Try pasting and then clicking the Tx button with it all selected. I believe the forum also pops up a little notification when you paste if you want to paste as plain text. @Draco18s okay, I will do that
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.