• Recently Browsing

    No registered users viewing this page.

  • Posts

    • How does one find/acquire this plugin? Not that I use IntelliJ, but for the folks that do, just because "it exists" doesn't give enough information to find and use it.
    • Hello, I'm trying to make a custom leaf block in my mod (for both 1.14 and 1.15 [and probably 1.16 now that that's out]) and have run into two problems. The first issue is the farthest leaves despawn, so to fix that I tried creating my own leaf class and extending the LeavesBlock class as shown, but upon loading the game I get this error:    Cannot set property IntegerProperty{name=distance, clazz=class java.lang.Integer, values=[1, 2, 3, 4, 5, 6, 7]} as it does not exist in Block{null}   package killerjdog51.biomeEnhancementsMod.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.LeavesBlock; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tags.BlockTags; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraft.world.World; public class PalmLeavesBlock extends LeavesBlock { public static final IntegerProperty DISTANCE = IntegerProperty.create("distance", 1, 11); public PalmLeavesBlock(Block.Properties properties) { super(properties); this.setDefaultState(this.stateContainer.getBaseState().with(DISTANCE, Integer.valueOf(11)).with(PERSISTENT, Boolean.valueOf(false))); } @Override public boolean ticksRandomly(BlockState state) { return state.get(DISTANCE) == 11 && !state.get(PERSISTENT); } @Override public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) { if (!state.get(PERSISTENT) && state.get(DISTANCE) == 11) { spawnDrops(state, worldIn, pos); worldIn.removeBlock(pos, false); } } @Override public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { worldIn.setBlockState(pos, updateDistance(state, worldIn, pos), 3); } @Override public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { int i = getDistance(facingState) + 1; if (i != 1 || stateIn.get(DISTANCE) != i) { worldIn.getPendingBlockTicks().scheduleTick(currentPos, this, 1); } return stateIn; } private static BlockState updateDistance(BlockState p_208493_0_, IWorld p_208493_1_, BlockPos p_208493_2_) { int i = 11; try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) { for(Direction direction : Direction.values()) { blockpos$pooledmutableblockpos.setPos(p_208493_2_).move(direction); i = Math.min(i, getDistance(p_208493_1_.getBlockState(blockpos$pooledmutableblockpos)) + 1); if (i == 1) { break; } } } return p_208493_0_.with(DISTANCE, Integer.valueOf(i)); } private static int getDistance(BlockState neighbor) { if (BlockTags.LOGS.contains(neighbor.getBlock())) { return 0; } else { return neighbor.getBlock() instanceof PalmLeavesBlock ? neighbor.get(DISTANCE) : 11; } } @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(DISTANCE, PERSISTENT); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return updateDistance(this.getDefaultState().with(PERSISTENT, Boolean.valueOf(true)), context.getWorld(), context.getPos()); } }   So far the best solution I could think of was just to copy the entire LeavesBlock class and replace the necessary values since it appears that there's some sort of conflict between my distance property and LeavesBlock's distance property (I tried changing all the values to newdistance and that didn't work). I want to try avoiding this if possible and just find a solution that involves extending the LeavesBlock class and overriding the necessary functions to increase the distance.  The second issue is that my leaves are all grayed out. I saw that in 1.12.2 people created a color manager class for this, I was wondering if that was still the case in 1.14/1.15?   Thanks for the feedback, I'll really appreciate it. 
    • To add on to this, if you're using IntelliJ there is a Minecraft development plugin that gives you the option to get the SRG name of something on right click.
    • Be aware that the csv files, while organized by class, don't tell you what class a given method is in, so if you have a field name that's rather common (say, "world") then you're going to have trouble. Find a different field in the same class that's more unique, then look for the one you actually want nearby.
    • Try taking a look at Archimedes Ships mod for 1.15 or something, I recall seeing one in reddit but I don't remember the name, since probably nothing much has changed from 1.15 to 1.16 just look at its code and try immitating it, I don't know if it has a github tho.
  • Topics

  • Who's Online (See full list)