Skip to content

Commit e6e91fd

Browse files
removal of unused legacy stuff + small fixes + more todos
1 parent 12e6c49 commit e6e91fd

34 files changed

+139
-2203
lines changed

src/main/java/com/rae/creatingspace/api/squedule/RocketSchedule.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ public static <T> List<? extends Component> getTypeOptions(List<Pair<ResourceLoc
6868
public boolean cyclic;
6969
public int savedProgress;
7070

71+
public RocketSchedule(List<ScheduleEntry> entries, boolean cyclic, int savedProgress) {
72+
this.entries = entries;
73+
this.cyclic = cyclic;
74+
this.savedProgress = savedProgress;
75+
}
76+
7177
public RocketSchedule() {
7278
entries = new ArrayList<>();
7379
cyclic = true;

src/main/java/com/rae/creatingspace/content/event/IgniteOnPlace.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
import net.minecraft.world.level.block.Blocks;
1010
import net.minecraft.world.level.block.SaplingBlock;
1111
import net.minecraft.world.level.block.state.BlockState;
12-
import net.minecraftforge.event.level.BlockEvent;
13-
import net.minecraftforge.eventbus.api.SubscribeEvent;
14-
import net.minecraftforge.fml.common.Mod;
12+
import net.neoforged.bus.api.SubscribeEvent;
13+
import net.neoforged.fml.common.EventBusSubscriber;
14+
import net.neoforged.neoforge.event.level.BlockEvent;
15+
1516

1617
import java.util.Arrays;
1718
import java.util.HashSet;
1819
import java.util.Set;
1920

20-
@Mod.EventBusSubscriber(modid = CreatingSpace.MODID)
21+
@EventBusSubscriber(modid = CreatingSpace.MODID)
2122
public class IgniteOnPlace {
2223
static Set<Block> dirtLikeBlocks = new HashSet<>(Arrays.asList(Blocks.DIRT, Blocks.GRASS_BLOCK, Blocks.PODZOL, Blocks.MYCELIUM, Blocks.ROOTED_DIRT, Blocks.COARSE_DIRT));
2324

src/main/java/com/rae/creatingspace/content/fluids/meter/FlowGaugeBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static boolean isOpenAt(BlockState state, Direction direction) {
108108
return state.getValue(FACING).getClockWise().getAxis() == direction.getAxis();
109109
}
110110
@Override
111-
public boolean isPathfindable(BlockState state, BlockGetter reader, BlockPos pos, PathComputationType type) {
111+
public boolean isPathfindable(BlockState state, PathComputationType type) {
112112
return false;
113113
}
114114

src/main/java/com/rae/creatingspace/content/life_support/sealer/RoomPressuriserBlock.java

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.rae.creatingspace.content.life_support.sealer;
22

33
import com.rae.creatingspace.init.ingameobject.BlockEntityInit;
4-
import com.rae.creatingspace.legacy.server.blockentities.atmosphere.SealerBlockEntity;
54
import com.simibubi.create.content.kinetics.base.DirectionalAxisKineticBlock;
65
import com.simibubi.create.foundation.block.IBE;
76
import net.minecraft.core.BlockPos;
87
import net.minecraft.core.Direction;
9-
import net.minecraft.world.InteractionHand;
108
import net.minecraft.world.InteractionResult;
119
import net.minecraft.world.entity.player.Player;
1210
import net.minecraft.world.item.ItemStack;
@@ -21,10 +19,9 @@
2119
import net.minecraft.world.phys.BlockHitResult;
2220
import net.minecraft.world.phys.shapes.CollisionContext;
2321
import net.minecraft.world.phys.shapes.VoxelShape;
22+
import org.jetbrains.annotations.NotNull;
2423
import org.jetbrains.annotations.Nullable;
2524

26-
import java.util.function.Function;
27-
2825
import static com.rae.creatingspace.init.graphics.ShapesInit.AIR_LIQUEFIER;
2926

3027
public class RoomPressuriserBlock extends DirectionalAxisKineticBlock implements IBE<RoomPressuriserBlockEntity> {
@@ -36,7 +33,7 @@ public RoomPressuriserBlock(Properties properties) {
3633
}
3734

3835
@Override
39-
public VoxelShape getShape(BlockState state, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
36+
public @NotNull VoxelShape getShape(BlockState state, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
4037
return AIR_LIQUEFIER.get(state.getValue(FACING));
4138
}
4239

@@ -47,7 +44,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
4744

4845
//only for debugging -> this machine will have no GUI to comply with create
4946
@Override
50-
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
47+
protected @NotNull InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
5148
ItemStack held = player.getMainHandItem();
5249
if (!level.isClientSide && held.isEmpty()) {
5350
if (level.getBlockEntity(pos) instanceof RoomPressuriserBlockEntity be) {
@@ -58,23 +55,6 @@ protected InteractionResult useWithoutItem(BlockState state, Level level, BlockP
5855
return super.useWithoutItem(state, level, pos, player, hitResult);
5956
}
6057

61-
/*
62-
@OnlyIn(value = Dist.CLIENT)
63-
protected void displayScreen(SealerBlockEntity be, Player player) {
64-
if (!(player instanceof LocalPlayer))
65-
return;
66-
ScreenOpener.open(new SealerScreen(be));
67-
}*/
68-
69-
/*@Override
70-
public void onRemove(BlockState blockState, Level level, BlockPos pos, BlockState state, boolean isMoving) {
71-
BlockEntity be = this.getBlockEntity(level,pos);
72-
if (be instanceof SealerBlockEntity sealerBlockEntity){
73-
sealerBlockEntity.removeO2inRoom(level);
74-
}
75-
super.onRemove(blockState, level, pos, state, isMoving);
76-
}
77-
*/
7858
@Override
7959
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) {
8060
IBE.onRemove(state, world, pos, newState);
@@ -93,8 +73,8 @@ public BlockEntityType<? extends RoomPressuriserBlockEntity> getBlockEntityType(
9373
@Override
9474
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
9575
return level.isClientSide() ? null : ($0, pos, $1, blockEntity) -> {
96-
if (blockEntity instanceof SealerBlockEntity sealerBlockEntity) {
97-
sealerBlockEntity.tick(level, pos, state);
76+
if (blockEntity instanceof RoomPressuriserBlockEntity sealerBlockEntity) {
77+
sealerBlockEntity.tick();
9878
}
9979
};
10080
}

src/main/java/com/rae/creatingspace/content/life_support/sealer/RoomPressuriserBlockEntity.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,24 @@
22

33
import com.rae.creatingspace.init.TagsInit;
44
import com.rae.creatingspace.init.ingameobject.EntityInit;
5-
import com.rae.creatingspace.legacy.server.blocks.atmosphere.SealerBlock;
65
import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation;
76
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
8-
import net.minecraft.ChatFormatting;
97
import net.minecraft.core.BlockPos;
108
import net.minecraft.core.Direction;
119
import net.minecraft.core.HolderLookup;
1210
import net.minecraft.nbt.CompoundTag;
1311
import net.minecraft.network.chat.Component;
14-
import net.minecraft.resources.ResourceLocation;
1512
import net.minecraft.world.level.block.entity.BlockEntityType;
1613
import net.minecraft.world.level.block.state.BlockState;
1714
import net.minecraft.world.phys.AABB;
1815
import net.minecraft.world.phys.Vec3;
1916
import net.neoforged.neoforge.fluids.FluidStack;
2017
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
2118
import net.neoforged.neoforge.fluids.capability.templates.FluidTank;
22-
import org.apache.logging.log4j.core.tools.picocli.CommandLine;
2319
import org.jetbrains.annotations.NotNull;
2420
import org.jetbrains.annotations.Nullable;
2521

2622
import java.util.List;
27-
import java.util.Map;
2823

2924
public class RoomPressuriserBlockEntity extends KineticBlockEntity implements IHaveGoggleInformation {
3025
public RoomPressuriserBlockEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {

src/main/java/com/rae/creatingspace/content/life_support/spacesuit/OxygenBacktankArmorLayer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.rae.creatingspace.content.life_support.spacesuit;
22

33
import com.mojang.blaze3d.vertex.PoseStack;
4+
import com.simibubi.create.foundation.mixin.accessor.EntityRenderDispatcherAccessor;
45
import net.createmod.catnip.render.CachedBuffers;
56
import net.createmod.catnip.render.SuperByteBuffer;
67
import net.minecraft.client.model.EntityModel;
@@ -59,7 +60,7 @@ public void render(PoseStack ms, MultiBufferSource buffer, int light, LivingEnti
5960
public static void registerOnAll(EntityRenderDispatcher renderManager) {
6061
for (EntityRenderer<? extends Player> renderer : renderManager.getSkinMap().values())
6162
registerOn(renderer);
62-
for (EntityRenderer<?> renderer : renderManager.renderers.values())
63+
for (EntityRenderer<?> renderer : ((EntityRenderDispatcherAccessor) renderManager).create$getRenderers().values())
6364
registerOn(renderer);
6465
}
6566

src/main/java/com/rae/creatingspace/content/life_support/spacesuit/OxygenBacktankBlock.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package com.rae.creatingspace.content.life_support.spacesuit;
22

3+
import com.mojang.serialization.MapCodec;
34
import com.rae.creatingspace.init.graphics.ShapesInit;
45
import com.rae.creatingspace.init.ingameobject.BlockEntityInit;
56
import com.simibubi.create.AllEnchantments;
67
import com.simibubi.create.foundation.block.IBE;
78
import net.minecraft.core.BlockPos;
89
import net.minecraft.core.Direction;
10+
import net.minecraft.core.component.DataComponents;
911
import net.minecraft.nbt.CompoundTag;
1012
import net.minecraft.nbt.ListTag;
11-
import net.minecraft.network.chat.Component;
1213
import net.minecraft.sounds.SoundEvents;
1314
import net.minecraft.sounds.SoundSource;
14-
import net.minecraft.world.InteractionHand;
1515
import net.minecraft.world.InteractionResult;
1616
import net.minecraft.world.entity.EquipmentSlot;
1717
import net.minecraft.world.entity.LivingEntity;
@@ -38,7 +38,7 @@
3838
import net.minecraft.world.phys.HitResult;
3939
import net.minecraft.world.phys.shapes.CollisionContext;
4040
import net.minecraft.world.phys.shapes.VoxelShape;
41-
import net.minecraftforge.common.util.FakePlayer;
41+
import net.neoforged.neoforge.common.util.FakePlayer;
4242

4343
import java.util.Optional;
4444

@@ -49,6 +49,11 @@ public OxygenBacktankBlock(Properties properties) {
4949
super(properties);
5050
registerDefaultState(defaultBlockState().setValue(BlockStateProperties.WATERLOGGED, false));
5151
}
52+
//TODO make this according to other codec implementation (copy past with correct name of the class)
53+
@Override
54+
protected MapCodec<? extends HorizontalDirectionalBlock> codec() {
55+
return null;
56+
}
5257

5358
@Override
5459
public FluidState getFluidState(BlockState state) {
@@ -103,18 +108,19 @@ public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, LivingEnt
103108
if (worldIn.isClientSide)
104109
return;
105110
withBlockEntityDo(worldIn, pos, be -> {
106-
be.setCapacityEnchantLevel(stack.getEnchantmentLevel(AllEnchantments.CAPACITY.get()));
107-
be.setOxygenLevel((int) stack.getOrCreateTag()
111+
//
112+
be.setCapacityEnchantLevel(stack.getEnchantmentLevel(worldIn.holderOrThrow(AllEnchantments.CAPACITY)));
113+
be.setOxygenLevel((int) stack.getOrCreateTag()//TODO implement a DataComponent for Oxygen Level in DataComponentInit
108114
.getFloat("Oxygen"));
109115
if (stack.isEnchanted())
110-
be.setEnchantmentTag(stack.getEnchantmentTags());
111-
if (stack.hasCustomHoverName())
116+
be.setEnchantmentTag(stack.getEnchantmentTags());//TODO look at BacktankBlock
117+
if (stack.has(DataComponents.CUSTOM_NAME))
112118
be.setCustomName(stack.getHoverName());
113119
});
114120
}
115121

116122
@Override
117-
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand,
123+
public InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player,
118124
BlockHitResult hit) {
119125
if (player instanceof FakePlayer)
120126
return InteractionResult.PASS;
@@ -179,7 +185,7 @@ public BlockEntityType<? extends OxygenBacktankBlockEntity> getBlockEntityType()
179185
}
180186

181187
@Override
182-
public boolean isPathfindable(BlockState state, BlockGetter reader, BlockPos pos, PathComputationType type) {
188+
public boolean isPathfindable(BlockState state, PathComputationType type) {
183189
return false;
184190
}
185191

src/main/java/com/rae/creatingspace/content/ponders/FluidScene.java

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)