Jump to content

[1.13.2] Vanilla block replacement


Pyre540

Recommended Posts

Hey,

What is the correct way to replace vanila blocks in forge 1.13.2?

I tried to register my block with vanilla registry name (similar to what I was doing in 1.12.2) but unfortunately it didn't work (stacktrace below).

 

My block:

Spoiler

package pyre.blockenlightenment.block;

import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;

public class BlockCustomGlass extends BlockGlass {

    public BlockCustomGlass() {
        super(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS));
    }

    @Override
    public boolean isSideInvisible(IBlockState state, IBlockState adjacentBlockState, EnumFacing side) {

        if (adjacentBlockState.getBlock() instanceof BlockCutoutEnlightenedBlock) {
            //do something
        }
        return super.isSideInvisible(state, adjacentBlockState, side);
    }
}

 

 

Registering of block:

Spoiler

@Mod.EventBusSubscriber(modid = Reference.MOD_ID, bus = Bus.MOD)
public class RegistryHandler {

    @SubscribeEvent
    public static void onBlockRegister(final RegistryEvent.Register<Block> event) {
        event.getRegistry().register(new BlockCustomGlass().setRegistryName(new ResourceLocation("minecraft", "glass")));
    }
}

 

 

Latest.log

Spoiler

[01cze2019 21:42:34.355] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmluserdevclient, --fml.mcpVersion, 20190213.203750, --fml.mcVersion, 1.13.2, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 25.0.202, --version, MOD_DEV, --assetIndex, 1.13.1, --assetsDir, C:\Users\kamil\.gradle\caches\forge_gradle\assets, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}]
[01cze2019 21:42:34.358] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher starting: java version 1.8.0_181
[01cze2019 21:42:34.641] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[01cze2019 21:42:35.054] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevclient' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\kamil\.gradle\caches\forge_gradle\assets, --assetIndex, 1.13.1, --username, Dev, --accessToken, ❄❄❄❄❄❄❄❄, --userProperties, {}]
[01cze2019 21:42:36.406] [Client thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev
[01cze2019 21:42:41.262] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer:
[01cze2019 21:42:41.277] [Client thread/INFO] [net.minecraft.client.Minecraft/]: LWJGL Version: 3.1.6 build 14
[01cze2019 21:42:42.608] [Client thread/INFO] [net.minecraftforge.fml.ModLoader/CORE]: Loading Network data for FML net version: FML2
[01cze2019 21:42:42.654] [modloading-worker-2/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 25.0.219, for MC 1.13.2 with MCP 20190213.203750
[01cze2019 21:42:42.654] [modloading-worker-2/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v25.0.219 Initialized
[01cze2019 21:42:45.504] [Client thread/INFO] [net.minecraftforge.registries.GameData/]: Potentially Dangerous alternative prefix `minecraft` for name `glass`, expected `blockenlightenment`. This could be a intended override, but in most cases indicates a broken mod.
[01cze2019 21:42:45.509] [Client thread/ERROR] [net.minecraftforge.registries.GameData/REGISTRIES]: Registry replacements for vanilla block 'minecraft:glass' must not change the number or order of blockstates.
	Old: 
	New: 
[01cze2019 21:42:45.509] [Client thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/]: Exception caught during firing event: Invalid vanilla replacement. See log for details.
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: class pyre.blockenlightenment.util.handler.RegistryHandler onBlockRegister(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		2: ASM: class pyre.blockenlightenment.util.handler.RegistryHandler registerTileEntities(Lnet/minecraftforge/event/RegistryEvent$Register;)V
java.lang.RuntimeException: Invalid vanilla replacement. See log for details.
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:342)
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:306)
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:368)
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:300)
	at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:125)
	at pyre.blockenlightenment.util.handler.RegistryHandler.onBlockRegister(RegistryHandler.java:22)
	at net.minecraftforge.eventbus.ASMEventHandler_4_RegistryHandler_onBlockRegister_Register.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:254)
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:105)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65)
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:111)
	at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$4(ModList.java:111)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:111)
	at net.minecraftforge.fml.ModList.lambda$static$0(ModList.java:82)
	at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:70)
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:153)
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:891)
	at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:141)
	at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:63)
	at net.minecraft.client.Minecraft.init(Minecraft.java:412)
	at net.minecraft.client.Minecraft.run(Minecraft.java:345)
	at net.minecraft.client.main.Main.main(SourceFile:144)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55)
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50)
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59)
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44)
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98)

[01cze2019 21:42:45.511] [Client thread/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:blocks> dispatch for modid blockenlightenment
java.lang.RuntimeException: Invalid vanilla replacement. See log for details.
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:342) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.GameData$BlockCallbacks.onAdd(GameData.java:306) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:368) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.ForgeRegistry.add(ForgeRegistry.java:300) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.ForgeRegistry.register(ForgeRegistry.java:125) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at pyre.blockenlightenment.util.handler.RegistryHandler.onBlockRegister(RegistryHandler.java:22) ~[classes/:?]
	at net.minecraftforge.eventbus.ASMEventHandler_4_RegistryHandler_onBlockRegister_Register.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:254) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:105) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:25.0]
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_181]
	at java.util.function.Consumer.lambda$andThen$0(Consumer.java:65) ~[?:1.8.0_181]
	at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:111) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent$4(ModList.java:111) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_181]
	at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:111) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModList.lambda$static$0(ModList.java:82) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:70) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:153) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:891) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:141) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:63) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:412) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:345) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.main.Main.main(SourceFile:144) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?]
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
[01cze2019 21:42:45.526] [Client thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event LOAD_REGISTRIES, 1 errors found
[01cze2019 21:42:45.526] [Client thread/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
	at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:274) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:65) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:412) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:345) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.main.Main.main(SourceFile:144) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?]
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
[01cze2019 21:42:45.547] [Client thread/INFO] [net.minecraft.resources.SimpleReloadableResourceManager/]: Reloading ResourceManager: main, forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar, Default
[01cze2019 21:42:46.918] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager/]: Starting up SoundSystem version 201809301515...
[01cze2019 21:42:47.130] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager/]: Initializing No Sound
[01cze2019 21:42:47.130] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager/]: (Silent Mode)
[01cze2019 21:42:47.193] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager/]: OpenAL initialized.
[01cze2019 21:42:47.520] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager/SOUNDS]: Preloading sound minecraft:sounds/ambient/underwater/underwater_ambience.ogg
[01cze2019 21:42:47.521] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager/SOUNDS]: Sound engine started
[01cze2019 21:42:52.616] [Client thread/INFO] [net.minecraft.client.renderer.texture.TextureMap/]: Max texture size: 16384
[01cze2019 21:42:55.158] [Client thread/INFO] [net.minecraft.client.renderer.texture.TextureMap/]: Created: 512x512 textures-atlas
[01cze2019 21:42:57.551] [Client thread/ERROR] [net.minecraftforge.fml.ModLoader/LOADING]: Skipping lifecycle event ENQUEUE_IMC, 1 errors found.
[01cze2019 21:42:57.551] [Client thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event ENQUEUE_IMC, 1 errors found
[01cze2019 21:42:57.551] [Client thread/FATAL] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
	at net.minecraftforge.eventbus.EventBus.shutdown(EventBus.java:274) ~[eventbus-0.9.2-service.jar:?]
	at net.minecraftforge.fml.client.ClientModLoader.end(ClientModLoader.java:76) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:479) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:345) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at net.minecraft.client.main.Main.main(SourceFile:144) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?]
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [forge-1.13.2-25.0.219_mapped_snapshot_20190512-1.13.2.jar:?]
[01cze2019 21:42:57.552] [Client thread/WARN] [net.minecraft.client.GameSettings/]: Skipping bad option: lastServer:
[01cze2019 21:42:57.594] [Client thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded
[01cze2019 21:42:58.445] [Realms Notification Availability checker #1/INFO] [com.mojang.realmsclient.client.RealmsClient/]: Could not authorize you against Realms server: Invalid session id

 

 

Link to comment
Share on other sites

Ok so I checked what exactly is going on using debugger and found out that there is validStates mismatch (screen below):

- valid state for BlockGlass is apparently Block{minecraft:air}

- valid state for my block is Block{minecraft:glass}

 

Any idea why is that?

I also tried to register original glass block to check if that will change something but the effect is the same.

event.getRegistry().register(new BlockGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(0.3F).sound(SoundType.GLASS)).setRegistryName(new ResourceLocation("minecraft", "glass")));

 

Screen:

Spoiler

SF3PD8C.png

 

Link to comment
Share on other sites

  • 3 months later...

Did you find a solution for that problem? I have the same problem even if the number and order of states are matching. I also tried doing it with the exact same block that minecraft use to register it.

 

Registration

registry.registerAll(
                new BlockLog(MaterialColor.WOOD, Block.Properties.create(Material.WOOD, MaterialColor.OBSIDIAN).hardnessAndResistance(2.0F).sound(SoundType.WOOD)).setRegistryName("minecraft:oak_log")
        );

 

Error

Quote

[05Sep2019 10:39:44.482] [Client thread/ERROR] [net.minecraftforge.registries.GameData/REGISTRIES]: Registry replacements for vanilla block 'minecraft:oak_log' must not change the number or order of blockstates.
    Old: axis={x,y,z}
    New: axis={x,y,z}

 

The Old and New are the exact same thing... 

Link to comment
Share on other sites

  • 5 months later...

I tried this in 1.15.2, but I get the same result as the first post. I can't change a vanilla block property. For example, I created a waterloggable door class
 

package com.lavalogged.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.DoorBlock;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.state.properties.DoorHingeSide;
import net.minecraft.state.properties.DoubleBlockHalf;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;

/**
 * @author JimiIT92
 */
public class WaterLoggableDoorBlock extends DoorBlock implements IWaterLoggable {

    public WaterLoggableDoorBlock(Properties builder) {
        super(builder);
        this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH).with(OPEN, false).with(HINGE, DoorHingeSide.LEFT).with(POWERED, false).with(HALF, DoubleBlockHalf.LOWER).with(BlockStateProperties.WATERLOGGED, true));
    }

    protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
        builder.add(HALF, FACING, OPEN, HINGE, POWERED, BlockStateProperties.WATERLOGGED);
    }

    public IFluidState getFluidState(BlockState state) {
        return Fluids.WATER.getStillFluidState(false);
    }

    public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, IFluidState fluidStateIn) {
        return IWaterLoggable.super.receiveFluid(worldIn, pos, state, fluidStateIn);
    }

    public boolean canContainFluid(IBlockReader worldIn, BlockPos pos, BlockState state, Fluid fluidIn) {
        return true;
    }

    @Deprecated
    public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
        if (!stateIn.get(BlockStateProperties.WATERLOGGED)) {
            this.receiveFluid(worldIn, currentPos, stateIn, Fluids.WATER.getStillFluidState(false));
        }
        worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
        return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos);
    }

    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
        return VoxelShapes.empty();
    }

    public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
        worldIn.getPendingFluidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
    }

    public Fluid pickupFluid(IWorld worldIn, BlockPos pos, BlockState state) {
        return Fluids.EMPTY;
    }
}

 

And then register with this
 

blockRegistryEvent.getRegistry().register(new WaterLoggableDoorBlock(Block.Properties.from(Blocks.OAK_DOOR))
                .setRegistryName(new ResourceLocation("minecraft", "oak_door")));


But the log says this
 

Registry replacements for vanilla block 'minecraft:oak_door' must not change the number or order of blockstates.
	Old: facing={north,south,west,east};half={upper,lower};hinge={left,right};open={true,false};powered={true,false}
	New: facing={north,south,west,east};half={upper,lower};hinge={left,right};open={true,false};powered={true,false};waterlogged={true,false}

 

So if we can't change or add properties to vanilla blocks like this, how can we do this?

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

You can't change the blockstates that a block has when making an override.

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.

Link to comment
Share on other sites

That's unfortunate, I understand why is it like this, but I still find it very limiting :/ I eventually thought that you can write your custom block with it's own ID and then replace it whrn is placed in the world, but is not the nicest solution I guess

Don't blame me if i always ask for your help. I just want to learn to be better :)

Link to comment
Share on other sites

8 hours ago, JimiIT92 said:

That's unfortunate, I understand why is it like this, but I still find it very limiting :/ I eventually thought that you can write your custom block with it's own ID and then replace it whrn is placed in the world, but is not the nicest solution I guess

You could have a copy of the vanilla block in your mod that is the exact same + always true water logged

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Slot Bank Mandiri memberikan penawaran untuk pendaftaran baru akun pro dengan win rate 99% di Museumbola, Secara resmi Slot Mandiri memberikan secara khusus bagi member Museumbola untuk merasakan maxwin pada awal daftar sampai seumur hidup selama bermain di Museumbola. jadi mau kah anda mengambil kesempatan ini? segera klik DAFTAR untuk bergabung bersama Museumbola sekarang juga.  
    • Slot Bank BNI adalah pilihan tergacor untuk memulai bermain slot judi Online dimuka bumi saat ini. Jika anda mempunyai Bank BNI, Anda berkesempatan mendapatkan Akun Pro atau ID pro untuk bermain slot. Tunggu apa lagi? Segera daftarkan diri anda sekarang dan dapatkan kemewahan menang maxwin di Museumbola.
    • Halo para penggemar slot online! Apakah Anda mencari pengalaman bermain slot yang seru dan menguntungkan? Apakah Anda ingin menikmati slot gacor dari server Thailand sambil melakukan deposit melalui Mandiri dengan kesempatan meraih kemenangan besar? Anda telah sampai di tempat yang tepat! Kami di WINNING303 siap memberikan Anda pengalaman bermain yang mengasyikkan dan menguntungkan. Mengapa Memilih WINNING303? WINNING303 telah dikenal sebagai salah satu platform terbaik untuk bermain slot dengan berbagai keunggulan yang kami tawarkan kepada para pemain kami. Berikut adalah beberapa alasan mengapa Anda harus memilih WINNING303: Slot Gacor dari Server Thailand Kami menyajikan koleksi slot gacor terbaik dari server Thailand yang pastinya akan memberikan Anda pengalaman bermain yang menarik dan menguntungkan. Nikmati berbagai jenis permainan slot dengan tingkat kemenangan yang tinggi dan jackpot yang menarik. Deposit Mudah Melalui Mandiri Kami memahami pentingnya kemudahan dalam bertransaksi bagi para pemain kami. Oleh karena itu, kami menyediakan layanan deposit melalui bank Mandiri, salah satu bank terbesar di Indonesia. Proses depositnya cepat, mudah, dan aman, sehingga Anda dapat langsung memulai petualangan bermain tanpa hambatan. Peluang Maxwin Besar Di WINNING303, kami selalu memberikan peluang untuk meraih kemenangan besar. Dengan berbagai promosi dan bonus menarik yang kami sediakan, Anda memiliki kesempatan untuk memenangkan hadiah-hadiah yang fantastis dan meraih maxwin dalam bermain slot.  
    • SLOT Ratubet77 adalah bocoran slot gacor rekomendasi dari Ratubet77 yang bisa anda temukan di SLOT Ratubet77. Situs SLOT Ratubet77 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ratubet77 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ratubet77 merupakan SLOT Ratubet77 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ratubet77. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ratubet77 hari ini yang telah disediakan SLOT Ratubet77. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ratubet77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ratubet77 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ratubet77 di link SLOT Ratubet77. DAFTAR SEKARANG DAFTAR SEKARANG DAFTAR SEKARANG
    • I am currently running the 1.20.1 Occultcraft modpack in Curseforge and am having numerous troubles making a mob farm with the apotheosis mod. When trying to modify the stats of the spawners specific stats such as the range, spawn count, and max entities reset to default after every spawn. When the spawners spawn boss mobs with certain attributes, that I'm not sure of, the building it is in explode even with mob griefing turned off. This has happened multiple times with varying sizes for the explosions. I was wonder if there is any way to disable these explosions from happening or disable boss abilities with something in the game. I also wanted to know a fix for the resetting stats on spawners and why this is happening.
  • Topics

×
×
  • Create New...

Important Information

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