Jump to content

Ideki

Members
  • Posts

    58
  • Joined

  • Last visited

Everything posted by Ideki

  1. Hello, Every time I compile I get the following error in the console. It does not stop/fail the compilation, but I think I should still address it. Any idea how to fix it ?
      • 1
      • Like
  2. nvm, just realized that patchouli is using MC 1.18.2 So I got the wrong MDK
  3. Ok, so I fixed my build.gradle Then I was able to compile. But minecraft started I got an error message from Patchouli that basically said that I was not using the correct version of Forge. So I changed the dependency to And I downloaded forge-1.18.1-39.1.0-mdk.zip I extracted the files and copied gradlew, gradlew.bat and the gradle folder to my mod folder. Now when I try to compile I get the following error: So I am guessing I did something wrong when attempting to update the forge mdk. Any idea what I am missing ?
  4. Hello, I am trying to use Patchouli so I can make a book in my mod. I copied the part I think I need from Botania's build-gradle. https://github.com/VazkiiMods/Botania/blob/fb8d7db61c54930d29f4b22ab988a783d61c83da/Common/build.gradle https://github.com/VazkiiMods/Botania/blob/4697930092cd1cc1ad318abc9ab7ebf58ee9b5ce/Forge/build.gradle But the compilation fails with the following error: Where does compileOnly() come from? This is my build.gradle: buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } maven { name = "Jared" url = "https://maven.blamejared.com/" } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true compileOnly "vazkii.patchouli:Patchouli-xplat:1.18.2-66-SNAPSHOT" implementation fg.deobf("vazkii.patchouli:Patchouli:1.18.2-66-SNAPSHOT") } } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' version = '1.0' group = 'com.ideki.test_mod' archivesBaseName = 'test_mod' java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { mappings channel: 'official', version: '1.18.1' accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { client { workingDirectory project.file('run') mods { test_mod { source sourceSets.main } } } server { workingDirectory project.file('run') mods { test_mod { source sourceSets.main } } } data { workingDirectory project.file('run') args '--mod', archivesBaseName, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { test_mod { source sourceSets.main } } } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { } dependencies { minecraft 'net.minecraftforge:forge:1.18.1-39.0.5' } jar { manifest { attributes([ "Specification-Title" : "test_mod", "Specification-Vendor" : "Ideki", "Specification-Version" : "1", "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, "Implementation-Vendor" : "Ideki", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } jar.finalizedBy('reobfJar') publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } }
  5. Hello, Is it possible to rotate a block every tick by a given degree/radian? I have a block that I would like to rotate on its own each tick around its Y axis.
  6. [Edited replied to the wrong post]
  7. So is it a lost knowledge ? Nobody knows how to do this anymore?
  8. ok, so if I go the other way around and make the speed 3600000 then that should discourage most people to try and break it. Right ?
  9. What would happen if I made the speed of 0 ? Would that keep it unbreakable but pushable ?
  10. Hello, I am trying to create an unbreakable block but that I can move with pistons. So I got the indestructible part figured out from the BEDROCK block. And I get the properties of GLASS to make it unspawnable. But it looks that it also makes it unpushable. These are the properties of my block: public static final BlockBehaviour.Properties MY_BLOCK_PROPERTIES = BlockBehaviour.Properties .of(Material.GLASS, MaterialColor.TERRACOTTA_BLACK) .strength(-1.0F, 3600000.0F) .noDrops() .sound(SoundType.METAL); Any idea how I can make my block pushable ?
  11. Hello, Anybody knows how to make a Prism (like a pyramid) shape in 1.18 ? Like the spikes from Extra Utilities, or Carpenter's Blocks. Is there a 1.18 mod that does it? ex: I tried to do it with BLockBench, but could not figure out how to do it.
  12. I figured it out. The BlockInit was using the wrong block. Since I have 2 blocks (toggle and timer) and I copied timer from toggle. BlockInit was using Toggle instead of Timer. And the behavior are similar enough that I did not initially see the problem. Thank you for trying to help me on this.
  13. Yes, the property is registered to the block state too public class ActivatedBlock extends HorizontalDirectionalBlock { public static final BooleanProperty IS_ACTIVATED = BooleanProperty.create("is_activated"); public ActivatedBlock(Properties properties) { super(properties); registerDefaultState(defaultBlockState().setValue(IS_ACTIVATED, Boolean.valueOf(false))); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { super.createBlockStateDefinition(builder); builder.add(IS_ACTIVATED); } public int getSignal(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, Direction direction) { return blockState.getValue(IS_ACTIVATED) ? 15 : 0; } public int getDirectSignal(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, Direction direction) { return blockState.getValue(IS_ACTIVATED) ? 15 : 0; } } Yes, I checked the debugger. And nothing comes up in the console. That's why I put all those println.
  14. The IS_ACTIVATED property is declared in the parent ActivatedBlock class. My problem is that the following function is never called: public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) In the use function I do the following, but nothing happens level.scheduleTick(blockPos, blockstate.getBlock(), 2 + level.random.nextInt(5));
  15. Hello, I am trying to schedule a tick on a block when I right click it. But somehow I never get the tick event to trigger. Any idea what is going on? public class ActivatedTimerBlock extends ActivatedBlock { public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); public ActivatedTimerBlock(Properties properties) { super(properties); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { super.createBlockStateDefinition(builder); builder.add(ACTIVE); } private boolean isTicking(BlockState state) { return state.hasProperty(IS_ACTIVATED) && state.getValue(IS_ACTIVATED); } @Override public InteractionResult use(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) { if (level.isClientSide) { return InteractionResult.SUCCESS; } else { BlockState blockstate = this.pull(blockState, level, blockPos); float f = blockstate.getValue(IS_ACTIVATED) ? 0.6F : 0.5F; level.playSound((Player) null, blockPos, SoundEvents.LEVER_CLICK, SoundSource.BLOCKS, 0.3F, f); level.gameEvent(player, blockstate.getValue(IS_ACTIVATED) ? GameEvent.BLOCK_SWITCH : GameEvent.BLOCK_UNSWITCH, blockPos); level.scheduleTick(blockPos, blockstate.getBlock(), 2 + level.random.nextInt(5)); return InteractionResult.CONSUME; } } public BlockState pull(BlockState blockState, Level level, BlockPos blockPos) { blockState = blockState.cycle(IS_ACTIVATED); level.setBlock(blockPos, blockState, 3); this.updateNeighbours(blockState, level, blockPos); return blockState; } public boolean isSignalSource(BlockState blockState) { return true; } private void updateNeighbours(BlockState blockState, Level level, BlockPos blockPos) { level.updateNeighborsAt(blockPos, this); } @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) { super.tick(state, world, pos, random); System.out.println("tick"); if (world.isClientSide) { return; } if (isTicking(state)) { System.out.println("ticking"); if (state.getValue(ACTIVE)) { System.out.println("active"); world.setBlockAndUpdate(pos, state.setValue(IS_ACTIVATED, false).setValue(ACTIVE, false)); } else { System.out.println("not active"); world.setBlockAndUpdate(pos, state.setValue(ACTIVE, true)); world.scheduleTick(pos, this, 15); } } } }
  16. Thanks a lot. I was able to figure out how to use the ItemBlockRenderTypes.setRenderLayer with your advice
  17. Or can I change the render type of my block to -1 as according to the following old documentation that would make it not rendered (like air). Minecraft Modding: Block Rendering [1.8]
  18. Hello, I am trying to create a transparent block. It looks like previous version of minecraft supported the following code: @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } But 1.18 does not seem to have those classes. This is my class: public class ActivatedDisappearBlock extends Block { public static final BooleanProperty IS_ACTIVATED = BooleanProperty.create("is_activated"); public ActivatedDisappearBlock(Properties properties) { super(properties); registerDefaultState(defaultBlockState().setValue(IS_ACTIVATED, Boolean.valueOf(false))); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { super.createBlockStateDefinition(builder); builder.add(IS_ACTIVATED); } private boolean isVanished(BlockState state) { return state.hasProperty(IS_ACTIVATED) && state.getValue(IS_ACTIVATED); } // Compilation fails @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } // Compilation fails @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { return isVanished(state) ? Shapes.empty() : super.getShape(state, world, pos, ctx); } @Override public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext ctx) { return isVanished(state) ? Shapes.empty() : super.getCollisionShape(state, world, pos, ctx); } public void neighborChanged(BlockState blockState, Level level, BlockPos blockPos, Block blockIn, BlockPos fromPos, boolean isMoving) { if (!level.isClientSide) { System.out.println(blockState); if (blockIn instanceof ActivatorBlock){ ActivatorBlock activator = (ActivatorBlock)blockIn; BlockState state = level.getBlockState(fromPos); var activating = state.getValue(IS_ACTIVATING); System.out.println(activating); blockState = blockState.setValue(IS_ACTIVATED, activating); level.setBlock(blockPos, blockState, 3); level.blockEntityChanged(blockPos); level.updateNeighbourForOutputSignal(blockPos, blockState.getBlock()); } } } }
  19. It is always the most obvious things that escape us the most. Thanks a lot
  20. Hello, I am trying to create a block that will trigger a redstone power for 10~15 seconds after being right-clicked with a specific item. I can render the block when if has no functions/property. But when I try to add a 'is_activating' property, the game crash on load with the following exception: This is my block code (I copied the functions from the Lever class): public class ActivatorBlock extends HorizontalDirectionalBlock { public static final BooleanProperty IS_ACTIVATING = BooleanProperty.create("is_activating"); public ActivatorBlock(Properties properties) { super(properties); registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH).setValue(IS_ACTIVATING, Boolean.valueOf(false))); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { super.createBlockStateDefinition(builder); builder.add(FACING); } @Override public BlockState getStateForPlacement(BlockPlaceContext context) { return defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); } @Override public InteractionResult use(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) { if (level.isClientSide) { BlockState blockstate1 = blockState.cycle(IS_ACTIVATING); return InteractionResult.SUCCESS; } else { BlockState blockstate = this.pull(blockState, level, blockPos); float f = blockstate.getValue(IS_ACTIVATING) ? 0.6F : 0.5F; level.playSound((Player)null, blockPos, SoundEvents.LEVER_CLICK, SoundSource.BLOCKS, 0.3F, f); level.gameEvent(player, blockstate.getValue(IS_ACTIVATING) ? GameEvent.BLOCK_SWITCH : GameEvent.BLOCK_UNSWITCH, blockPos); return InteractionResult.CONSUME; } } public BlockState pull(BlockState p_54677_, Level p_54678_, BlockPos p_54679_) { p_54677_ = p_54677_.cycle(IS_ACTIVATING); p_54678_.setBlock(p_54679_, p_54677_, 3); this.updateNeighbours(p_54677_, p_54678_, p_54679_); return p_54677_; } public int getSignal(BlockState p_54635_, BlockGetter p_54636_, BlockPos p_54637_, Direction p_54638_) { return p_54635_.getValue(IS_ACTIVATING) ? 15 : 0; } public int getDirectSignal(BlockState p_54670_, BlockGetter p_54671_, BlockPos p_54672_, Direction p_54673_) { return p_54670_.getValue(IS_ACTIVATING) ? 15 : 0; } public boolean isSignalSource(BlockState p_54675_) { return true; } private void updateNeighbours(BlockState p_54681_, Level p_54682_, BlockPos p_54683_) { p_54682_.updateNeighborsAt(p_54683_, this); //p_54682_.updateNeighborsAt(p_54683_.relative(getConnectedDirection(p_54681_).getOpposite()), this); } } The block is registered as: public static final BlockBehaviour.Properties TEST_BLOCK_PROPERTIES = BlockBehaviour.Properties .of(Material.GLASS, MaterialColor.TERRACOTTA_BLACK) .strength(-1.0F, 3600000.0F) .noDrops() .sound(SoundType.METAL); public static final RegistryObject<Block> ACTIVATOR_BLOCK = BLOCKS.register("activator_block", () -> new ActivatorBlock(TEST_BLOCK_PROPERTIES));
  21. Hello, I am trying to make a structural block that is non spawnable. I looked up the GLASS block and found that it set isValidSpawn. But I cannot figure out how to set it correctly, public static final BlockBehaviour.Properties TEST_BLOCK_PROPERTIES = BlockBehaviour.Properties .of(Material.HEAVY_METAL, MaterialColor.TERRACOTTA_BLACK) .strength(-1.0F, 3600000.0F) .noDrops() .sound(SoundType.METAL) .isValidSpawn(Blocks::never); IntelliJ reports the following problem: If I change the Blocks::never to false then I get the following error instead
  22. Works like a charm. Thank you
  23. Oh ok. I did not know that those functions are immutable. So I tried it, and I see now that the shape has changed (the black outline). But the texture remains in the same orientation as before. How can I make the texture rotate too?
  24. Hello, I am creating a multiblock structure when I use an item. And I want it to face the player when placed. But I cannot figure out how to rotate it. This i how I place the blocks (for now I am just trying to rotate it 90 clockwise) BlockState blockState = posBlock.Block.defaultBlockState(); blockState.setValue(HorizontalDirectionalBlock.FACING, Direction.SOUTH); blockState.rotate(level, posBlock.Pos, Rotation.CLOCKWISE_90); //blockState.setValue(HorizontalDirectionalBlock.FACING, Direction.SOUTH); //blockState.setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite()); level.setBlock(posBlock.Pos, blockState, 3); level.sendBlockUpdated(posBlock.Pos, blockState, blockState, Block.UPDATE_ALL_IMMEDIATE); This is one my multiblock class: public class lock00 extends HorizontalDirectionalBlock { private static final Map<Direction, VoxelShape> SHAPES = new EnumMap<>(Direction.class); private static final Optional<VoxelShape> SHAPE = Stream.of( // Shape removed for smaller text ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)); public Block00(Properties properties) { super(properties); registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH)); runCalculation(SHAPE.orElse(Shapes.block())); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { super.createBlockStateDefinition(builder); builder.add(FACING); } @Override public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPES.get(state.getValue(FACING)); } @Override public BlockState getStateForPlacement(BlockPlaceContext context) { return defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); } protected void runCalculation(VoxelShape shape) { for (Direction direction : Direction.values()) SHAPES.put(direction, Laputa.calculateShapes(direction, shape)); } } The blockstatte: { "variants": { "": { "model": "test_mod:block/block_00" } } } The model: { "credit": "Made with Blockbench", "texture_size": [32, 32], "textures": { "1": "laputa:blocks/a", "2": "laputa:blocks/b", "3": "laputa:blocks/c", "4": "laputa:blocks/d", "5": "laputa:blocks/e", "7": "laputa:blocks/f", "8": "laputa:blocks/g", "particle": "laputa:blocks/h" }, "elements": [ { "from": [10, 13, 7], "to": [15, 16, 9], "shade": false, "faces": { "north": {"uv": [0, 1, 5, 4], "texture": "#4"}, "east": {"uv": [5, 5, 7, 8], "texture": "#4"}, "south": {"uv": [0, 5, 5, 8], "texture": "#4"}, "west": {"uv": [7, 5, 9, 8], "texture": "#4"}, "up": {"uv": [5, 0, 10, 2], "texture": "#4"}, "down": {"uv": [5, 2, 10, 4], "texture": "#4"} } } ], "groups": [ { "name": "VoxelShapes", "origin": [8, 8, 8], "color": 0, "shade": false, "children": [ { "name": "Group", "origin": [8, 8, 8], "color": 0, "shade": false, "children": [0] } ] } ] }
  25. Thank you
×
×
  • Create New...

Important Information

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