11package fn10 .musicexpansion .blocks .entity ;
22
33import java .util .Iterator ;
4- import java .util .Map ;
5-
4+ import fn10 .musicexpansion .MusicExpanded ;
65import fn10 .musicexpansion .blocks .DiscBurnerBlock ;
76import fn10 .musicexpansion .menu .DiscBurnerMenu ;
87import fn10 .musicexpansion .reg .MusicExpandedAudio ;
1312import net .minecraft .core .NonNullList ;
1413import net .minecraft .nbt .CompoundTag ;
1514import net .minecraft .network .chat .Component ;
16- import net .minecraft .network .protocol .game .ClientboundBlockEntityDataPacket ;
1715import net .minecraft .network .protocol .game .ClientboundStopSoundPacket ;
1816import net .minecraft .server .level .ServerPlayer ;
1917import net .minecraft .sounds .SoundSource ;
2321import net .minecraft .world .inventory .AbstractContainerMenu ;
2422import net .minecraft .world .inventory .ContainerData ;
2523import net .minecraft .world .inventory .SimpleContainerData ;
24+ import net .minecraft .world .item .Item ;
2625import net .minecraft .world .item .ItemStack ;
2726import net .minecraft .world .level .Level ;
27+ import net .minecraft .world .level .block .Block ;
2828import net .minecraft .world .level .block .entity .BaseContainerBlockEntity ;
2929import net .minecraft .world .level .block .state .BlockState ;
3030import net .minecraft .world .level .storage .ValueInput ;
@@ -82,7 +82,8 @@ protected void saveAdditional(ValueOutput output) {
8282 ContainerHelper .saveAllItems (output , inventory );
8383 TypedOutputList <ItemStack > list = output .list ("burningCurrently" , ItemStack .CODEC );
8484 burningCurrently .forEach (stack -> {
85- list .add (stack );
85+ if (!stack .isEmpty ())
86+ list .add (stack );
8687 });
8788
8889 super .saveAdditional (output );
@@ -109,11 +110,6 @@ public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) {
109110 return saveWithoutMetadata (registryLookup );
110111 }
111112
112- @ Override
113- public ClientboundBlockEntityDataPacket getUpdatePacket () {
114- return ClientboundBlockEntityDataPacket .create (this );
115- }
116-
117113 public static void tick (Level world , BlockPos blockPos , BlockState blockState , DiscBurnerBlockEntity entity ) {
118114 if (world .isClientSide ())
119115 return ;
@@ -151,16 +147,16 @@ public static void tick(Level world, BlockPos blockPos, BlockState blockState, D
151147 entity .isBurning = true ;
152148 world .playSound (null , blockPos , MusicExpandedAudio .DISC_BURNER_START , SoundSource .BLOCKS );
153149 } else {
154- // MusicExpanded.LOGGER.info("Lets see if " + input1.toString() + " is " +
155- // entity.burningCurrently.get(0).toString());
156- // MusicExpanded.LOGGER.info("Lets see if " + input2.toString() + " is " +
157- // entity.burningCurrently.get(1).toString());
158150 if (!(ItemStack .matches (entity .burningCurrently .get (0 ), input1 )
159151 && ItemStack .matches (entity .burningCurrently .get (1 ), input2 ))) {
160152 entity .isBurning = false ;
161153 entity .stoppedSound = false ;
162154 }
163155 entity .burnTime --;
156+ if (entity .burnTime <= 0 ) {
157+ Block .popResource (world , blockPos , entity .inventory .get (0 ));
158+ entity .inventory .set (0 , ItemStack .EMPTY );
159+ }
164160 entity .data .set (0 , entity .burnTime );
165161 }
166162 } else if (entity .isBurning ) {
0 commit comments