Skip to content

Commit

Permalink
Thermoregulators now drop blocks correctly when broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz committed Jan 7, 2024
1 parent fcd979f commit e2c27a2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.util.RandomSource;
import net.minecraft.world.Containers;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -112,6 +113,13 @@ public RenderShape getRenderShape(BlockState state)
return RenderShape.MODEL;
}

@Override
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean $$4)
{
Containers.dropContentsOnDestroy(state, newState, level, pos);
super.onRemove(state, level, pos, newState, $$4);
}

/*@Override
public void animateTick(BlockState p_221253_, Level p_221254_, BlockPos p_221255_, RandomSource p_221256_)
{
Expand Down
1 change: 1 addition & 0 deletions common/src/main/java/toughasnails/core/ToughAsNails.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private static void addRegistrars()
regHelper.addRegistrar(Registries.MOB_EFFECT, ModPotions::registerEffects);
regHelper.addRegistrar(Registries.POTION, ModPotions::registerPotions);
regHelper.addRegistrar(Registries.CREATIVE_MODE_TAB, ModCreativeTab::registerCreativeTabs);
regHelper.addRegistrar(Registries.PARTICLE_TYPE, ModParticles::registerParticles);
}

private static void addHandlers()
Expand Down
24 changes: 24 additions & 0 deletions common/src/main/java/toughasnails/init/ModParticles.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright 2023, the Glitchfiend Team.
* All rights reserved.
******************************************************************************/
package toughasnails.init;

import net.minecraft.core.particles.ParticleType;
import net.minecraft.resources.ResourceLocation;
import toughasnails.api.TANAPI;

import java.util.function.BiConsumer;

public class ModParticles
{
public static void registerParticles(BiConsumer<ResourceLocation, ParticleType<?>> func)
{
}

private static ParticleType<?> register(BiConsumer<ResourceLocation, ParticleType<?>> func, String name, ParticleType<?> particle)
{
func.accept(new ResourceLocation(TANAPI.MOD_ID, name), particle);
return particle;
}
}

0 comments on commit e2c27a2

Please sign in to comment.