Jump to content

[MC 1.10.2] Extended TNT block does not blow up when fire destroys it.


Recommended Posts

Posted

I have a block which extends TNT and is working perfectly except that when fire burns it, it does not explode. I believe that I see the solution, adding my block to a specific if statement within the Fire class.

Is this the only way to make it so when fire destroys this block, then it Ignites? If so, how would one go about overriding this code?

-note: I am just using the standard lit TNT entity, with 0 fuse time, to make the explosion, and am happy to leave it as such.

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

Okey so I am trying to understand your question, but the only issue i can see from what you are asking is that you haven't:

public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face){

        return net.minecraft.init.Blocks.FIRE.getFlammability(this);

}

used this method in your TNT class, correct me if i'm wrong, but this is a forge hook that, does the job of what the init() method in the fire class does. Looking into 1.10.2 code shows that the TNT should just run the proper code on block deletion, thus the only issue I see in your TNT block is that it is not TNT, thus you must register it so that it can burn just like the regular TNT block, check the forge hooks like the above stated one in the Block class. Also, for future reference, it is much appreciated if you would post your code, though I think i grasped your question, if not, tell me.

Posted

Sorry I wasn't clear... The block burns just fine... Just doesn't blow up once fire consumes it. I tried that bit of code, and nothing changed (also its deprecated).  Sorry, here's my code for said block:

public class GunpowderBlock extends BlockTNT {

 

protected String name;

 

public GunpowderBlock(String name, Block BlockIn, Material material, float hardness, float resistance, int harvest, String tool) {

super();

 

this.name = name;

 

setUnlocalizedName(name);

setRegistryName(name);

setHardness(hardness);

setResistance(resistance);

setHarvestLevel(tool, harvest);

setSoundType(SoundType.SAND);

}

 

public int getFlammablility(IBlockAccess world, BlockPos pos, EnumFacing face) {

return net.minecraft.init.Blocks.FIRE.getFlammability(this);

}

 

public void registerItemModel(ItemBlock itemBlock) {

BettermentsMod.proxy.registerItemRenderer(itemBlock, 0, name);

}

 

@Override

public GunpowderBlock setCreativeTab(CreativeTabs tab) {

super.setCreativeTab(tab);

return this;

}

 

@Override

    public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)

    {

        if (!worldIn.isRemote)

        {

            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());

            entitytntprimed.setFuse((short)(0));

            worldIn.spawnEntityInWorld(entitytntprimed);

        }

    }

 

@Override

    public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)

    {

        if (!worldIn.isRemote)

        {

            if (((Boolean)state.getValue(EXPLODE)).booleanValue())

            {

                EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);

                entitytntprimed.setFuse((short)(0));

                worldIn.spawnEntityInWorld(entitytntprimed);

                worldIn.playSound((EntityPlayer)null, entitytntprimed.posX, entitytntprimed.posY, entitytntprimed.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);

            }

        }

    }

 

@Override

    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)

    {

        if (heldItem != null && (heldItem.getItem() == Items.FLINT_AND_STEEL || heldItem.getItem() == Items.FIRE_CHARGE))

        {

            this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);

            worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);

 

            if (heldItem.getItem() == Items.FLINT_AND_STEEL)

            {

                heldItem.damageItem(0, playerIn);

            }

            else if (!playerIn.capabilities.isCreativeMode)

            {

                --heldItem.stackSize;

            }

 

            return true;

        }

        else

        {

            return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);

        }

    }

 

}

 

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

I'm afraid i have been working on this a bit and also looking at others and how they might have solved this, but there doesn't seem to be a good answer that i can give. The only thing I can advise now is to try using an update tick, like from the block class or a tile entity (though  a tile entity would be a waste), or just bump this question till someone with an answer can help you, sorry.

 

Posted

The way I have solved it is just with overriding Fire in general with it extending MC's fire block and reflecting. Though, it would be best to make it a seperate mod and have it an API for other people to use.

Posted

Thanks, but I'm having trouble looking for a tutorial on how to replace a vanilla block/Item with my own block, that isn't for MC 1.7.10 or earlier. If you know of such a tutorial, I would greatly appreciate a link to it!

Additionally, core modding doesn't much appeal to me... but if that is the only solution, as it seems there isn't an easy way of doing this, then I am happy to give it a try...

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

You could try to override the getFlammability method. It wouldn't be perfect, but you could randomly explode when your block's getFlammability is checked. Sometimes it will, and sometimes it will be consumed before it can. You could even return zero (never catches vanilla fire), reserving all randomness to your own explosion. That might even mimic TNT correctly.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

You could try to override the getFlammability method. It wouldn't be perfect, but you could randomly explode when your block's getFlammability is checked. Sometimes it will, and sometimes it will be consumed before it can. You could even return zero (never catches vanilla fire), reserving all randomness to your own explosion. That might even mimic TNT correctly.

I've tried that already... It seems to do nothing. Unless you are referencing overriding some function, as getFlammablility cannot be overridden (TNT doesn't use it).

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

It looked like BlockFire called getFlammability on its way to spreading fire to its neighbors. A little bit after the call, it applied randomeness, and if spread, it would see if the neighbor was TNT and blow it up. Why can't you override getFlammability to hijack the decision process and blow up on your own terms?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

You could also override getFlammability, isFlammable, or getFireSpreadSpeed (each called when the fire attempts to spread to that block, at some point) and spawn your lit entity or explosion.

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.

Posted

You could also override getFlammability, isFlammable, or getFireSpreadSpeed (each called when the fire attempts to spread to that block, at some point) and spawn your lit entity or explosion.

Yeah, that's pretty much what I was saying at 07:35.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

In order to override that function, I need to create my own fire block (probably just copy, paste, and edit vanilla fire), right? But this block would then need to replace every instance of vanilla fire, both generated and placed. Does this require using ASM to inject the code, or is there a way to cause vanilla fire to reference my fire?

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

No. You override those methods on your TNT block so that when one of them is called you make it explode.

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.

Posted

No. You override those methods on your TNT block so that when one of them is called you make it explode.

I can't override functions that aren't contained in the parent class. TNT does not use any of the functions getFlammability, isFlammable, or getFireSpreadSpeed. Fire does. I did try creating a getFlammability and isFlammable functions, within my TNT block, and they do nothing, because they are not even being called.

Since I'm obviously not understanding this, is it possible to see an example?

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

The TNT Block extends the Block class, so you will be able to override the methods from the Block class which are not overridden in the TNT Block.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

The TNT Block extends the Block class, so you will be able to override the methods from the Block class which are not overridden in the TNT Block.

Thank you! That helps. I've overriden those functions, but have encountered another issue...

I don't see a way to either set its EXPLODE boolean to true, or to create the explosion. I need the World in order to create an explosion.

Obviously I forgot that tnt extended block, is there something else I'm missing?

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

All three of the methods I mentioned pass a World and BlockPos arguments.

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.

Posted

All three of the methods I mentioned pass a World and BlockPos arguments.

They pass type "IBlockAccess", not type "World".

*NVM just casted IBlockAccess to World and it worked perfectly. It now explodes when on fire!

*Here's the code that is working:

public class GunpowderBarrel extends BlockTNT {

protected String name;

public GunpowderBarrel(String name, Block BlockIn, Material material, float hardness, float resistance, int harvest, String tool) {
	super();

	this.name = name;

	setUnlocalizedName(name);
	setRegistryName(name);
	setHardness(hardness);
	setResistance(resistance);
	setHarvestLevel(tool, harvest);
	setSoundType(SoundType.WOOD);
}

@Override
    public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
    {
        if (worldIn.isBlockPowered(pos))
        {
        	this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)));
            worldIn.setBlockToAir(pos);
        }
    }
@Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face){
	this.onBlockDestroyedByExplosion((World) world, pos, null);
	System.out.println("getFlammability overriden");
        return 300;
    }
@Override
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face){
	System.out.println("isFlammable overriden");
        return getFlammability(world, pos, face) > 0;
    }
@Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face){
	System.out.println("getFireSpreadSpeed overriden");
        return 300;
    }

@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {
    return BlockRenderLayer.SOLID;
}

public void registerItemModel(ItemBlock itemBlock) {
	BettermentsMod.proxy.registerItemRenderer(itemBlock, 0, name);
}

@Override
public GunpowderBarrel setCreativeTab(CreativeTabs tab) {
	super.setCreativeTab(tab);
	return this;
}

@Override
    public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
    {
        if (!worldIn.isRemote)
        {
        	worldIn.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 10f, true);
        }
    }

@Override
    public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
    {
        if (!worldIn.isRemote)
        {
            if (((Boolean)state.getValue(EXPLODE)).booleanValue())
            {
            	worldIn.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 10f, true);
            }
        }
    }

@Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (heldItem != null && (heldItem.getItem() == Items.FLINT_AND_STEEL || heldItem.getItem() == Items.FIRE_CHARGE))
        {
            this.explode(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true)), playerIn);
            worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);

            if (heldItem.getItem() == Items.FLINT_AND_STEEL)
            {
                heldItem.damageItem(0, playerIn);
            }
            else if (!playerIn.capabilities.isCreativeMode)
            {
                --heldItem.stackSize;
            }

            return true;
        }
        else
        {
            return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
        }
    }

}

 

I am human and thus will make stupid and obvious mistakes and cannot be expected to know everything.

Posted

IBlockAccess is implemented by World.

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.

Posted

IBlockAccess is implemented by World.

 

But not every

IBlockAccess

is a

World

, it may be a

ChunkCache

or something else.

 

You should check that it is a

World

before casting.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

The one missing aspect is randomness. As written, your gunpowder will explode as soon as fire appears next to it. TNT has a random delay before the fire catches. If you don't care, then it doesn't matter.

 

Anyway, I am happy that my idea worked.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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