mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 12:33:57 +01:00
Fivepointone-ify
This commit is contained in:
parent
ce6ecad0f2
commit
2e3101b87a
@ -14,6 +14,7 @@ import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -9,6 +9,8 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@ -22,10 +24,10 @@ import com.simibubi.create.content.logistics.trains.entity.BogeyStyle;
|
||||
import com.simibubi.create.content.logistics.trains.entity.Carriage;
|
||||
import com.simibubi.create.content.logistics.trains.entity.CarriageBogey;
|
||||
import com.simibubi.create.content.logistics.trains.entity.TravellingPoint;
|
||||
import com.simibubi.create.content.logistics.trains.track.AbstractBogeyTileEntity;
|
||||
import com.simibubi.create.content.logistics.trains.track.AbstractBogeyBlockEntity;
|
||||
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
@ -59,9 +61,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractBogeyBlock<T extends AbstractBogeyTileEntity> extends Block implements ITE<T>, ProperWaterloggedBlock, ISpecialBlockItemRequirement, IWrenchable {
|
||||
public abstract class AbstractBogeyBlock<T extends AbstractBogeyBlockEntity> extends Block implements IBE<T>, ProperWaterloggedBlock, ISpecialBlockItemRequirement, IWrenchable {
|
||||
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS;
|
||||
static final List<ResourceLocation> BOGEYS = new ArrayList<>();
|
||||
public BogeySizes.BogeySize size;
|
||||
@ -199,7 +199,7 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyTileEntity> exte
|
||||
|
||||
BlockEntity be = level.getBlockEntity(pos);
|
||||
|
||||
if (!(be instanceof AbstractBogeyTileEntity sbte))
|
||||
if (!(be instanceof AbstractBogeyBlockEntity sbte))
|
||||
return InteractionResult.FAIL;
|
||||
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 20);
|
||||
@ -230,7 +230,7 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyTileEntity> exte
|
||||
CompoundTag oldData = sbte.getBogeyData();
|
||||
level.setBlock(pos, this.getStateOfSize(sbte, size), 3);
|
||||
BlockEntity newBlockEntity = level.getBlockEntity(pos);
|
||||
if (!(newBlockEntity instanceof AbstractBogeyTileEntity newTileEntity))
|
||||
if (!(newBlockEntity instanceof AbstractBogeyBlockEntity newTileEntity))
|
||||
return InteractionResult.FAIL;
|
||||
newTileEntity.setBogeyData(oldData);
|
||||
player.displayClientMessage(Lang.translateDirect("bogey.style.updated_style_and_size")
|
||||
@ -278,7 +278,7 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyTileEntity> exte
|
||||
|
||||
public BlockState getNextSize(Level level, BlockPos pos) {
|
||||
BlockEntity te = level.getBlockEntity(pos);
|
||||
if (te instanceof AbstractBogeyTileEntity sbte)
|
||||
if (te instanceof AbstractBogeyBlockEntity sbte)
|
||||
return this.getNextSize(sbte);
|
||||
return level.getBlockState(pos);
|
||||
}
|
||||
@ -304,7 +304,7 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyTileEntity> exte
|
||||
return target;
|
||||
}
|
||||
|
||||
public BlockState getNextSize(AbstractBogeyTileEntity sbte) {
|
||||
public BlockState getNextSize(AbstractBogeyBlockEntity sbte) {
|
||||
BogeySizes.BogeySize size = this.getSize();
|
||||
BogeyStyle style = sbte.getStyle();
|
||||
BlockState nextBlock = style.getNextBlock(size).defaultBlockState();
|
||||
@ -312,7 +312,7 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyTileEntity> exte
|
||||
return nextBlock;
|
||||
}
|
||||
|
||||
public BlockState getStateOfSize(AbstractBogeyTileEntity sbte, BogeySizes.BogeySize size) {
|
||||
public BlockState getStateOfSize(AbstractBogeyBlockEntity sbte, BogeySizes.BogeySize size) {
|
||||
BogeyStyle style = sbte.getStyle();
|
||||
BlockState state = style.getBlockOfSize(size).defaultBlockState();
|
||||
return copyProperties(sbte.getBlockState(), state);
|
||||
@ -320,7 +320,7 @@ public abstract class AbstractBogeyBlock<T extends AbstractBogeyTileEntity> exte
|
||||
|
||||
public BogeyStyle getNextStyle(Level level, BlockPos pos) {
|
||||
BlockEntity te = level.getBlockEntity(pos);
|
||||
if (te instanceof AbstractBogeyTileEntity sbte)
|
||||
if (te instanceof AbstractBogeyBlockEntity sbte)
|
||||
return this.getNextStyle(sbte.getStyle());
|
||||
return getDefaultStyle();
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ public class GlobalRailwayManager {
|
||||
}
|
||||
|
||||
private static boolean isTrackGraphDebugExtended() {
|
||||
return AllConfigs.CLIENT.showExtendedTrackGraphOnF3.get();
|
||||
return AllConfigs.client().showExtendedTrackGraphOnF3.get();
|
||||
}
|
||||
|
||||
public GlobalRailwayManager sided(LevelAccessor level) {
|
||||
|
@ -1,10 +1,16 @@
|
||||
package com.simibubi.create.content.logistics.trains;
|
||||
|
||||
import static com.simibubi.create.AllPartialModels.BOGEY_DRIVE;
|
||||
import static com.simibubi.create.AllPartialModels.BOGEY_FRAME;
|
||||
import static com.simibubi.create.AllPartialModels.BOGEY_PIN;
|
||||
import static com.simibubi.create.AllPartialModels.BOGEY_PISTON;
|
||||
import static com.simibubi.create.AllPartialModels.LARGE_BOGEY_WHEELS;
|
||||
import static com.simibubi.create.AllPartialModels.SMALL_BOGEY_WHEELS;
|
||||
|
||||
import com.jozufozu.flywheel.api.MaterialManager;
|
||||
import com.jozufozu.flywheel.util.transform.Transform;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
@ -13,15 +19,6 @@ import com.simibubi.create.foundation.utility.Iterate;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static com.simibubi.create.AllBlockPartials.LARGE_BOGEY_WHEELS;
|
||||
import static com.simibubi.create.AllBlockPartials.BOGEY_PIN;
|
||||
import static com.simibubi.create.AllBlockPartials.BOGEY_DRIVE;
|
||||
import static com.simibubi.create.AllBlockPartials.BOGEY_PISTON;
|
||||
import static com.simibubi.create.AllBlockPartials.SMALL_BOGEY_WHEELS;
|
||||
import static com.simibubi.create.AllBlockPartials.BOGEY_FRAME;
|
||||
|
||||
public class StandardBogeyRenderer {
|
||||
public static class CommonStandardBogeyRenderer extends BogeyRenderer.CommonRenderer {
|
||||
@Override
|
||||
|
@ -9,8 +9,8 @@ import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.logistics.trains.track.TrackBlock;
|
||||
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||
@ -139,6 +139,7 @@ public class TrackMaterial {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public record TrackModelHolder(PartialModel tie, PartialModel segment_left, PartialModel segment_right) {
|
||||
static final TrackModelHolder DEFAULT = new TrackModelHolder(AllBlockPartials.TRACK_TIE, AllBlockPartials.TRACK_SEGMENT_LEFT, AllBlockPartials.TRACK_SEGMENT_RIGHT);
|
||||
static final TrackModelHolder DEFAULT = new TrackModelHolder(AllPartialModels.TRACK_TIE,
|
||||
AllPartialModels.TRACK_SEGMENT_LEFT, AllPartialModels.TRACK_SEGMENT_RIGHT);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ public class CarriageContraption extends Contraption {
|
||||
bogeys++;
|
||||
if (bogeys == 2)
|
||||
secondBogeyPos = pos;
|
||||
return Pair.of(new StructureBlockInfo(pos, blockState, captureTE ? getTileEntityNBT(world, pos) : null),
|
||||
return Pair.of(new StructureBlockInfo(pos, blockState, captureTE ? getBlockEntityNBT(world, pos) : null),
|
||||
captureTE ? world.getBlockEntity(pos) : null);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ import java.util.function.Consumer;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.content.logistics.trains.track.AbstractBogeyTileEntity;
|
||||
import com.simibubi.create.content.logistics.trains.track.AbstractBogeyBlockEntity;
|
||||
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
||||
@ -741,7 +741,7 @@ public class Train {
|
||||
Vec3 bogeyPosition = bogey.getAnchorPosition();
|
||||
if (bogeyPosition == null) continue;
|
||||
BlockEntity be = level.getBlockEntity(new BlockPos(bogeyPosition));
|
||||
if (!(be instanceof AbstractBogeyTileEntity sbte))
|
||||
if (!(be instanceof AbstractBogeyBlockEntity sbte))
|
||||
continue;
|
||||
sbte.setBogeyData(bogey.bogeyData);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import com.simibubi.create.content.logistics.trains.management.edgePoint.EdgePoi
|
||||
import com.simibubi.create.content.logistics.trains.management.edgePoint.TrackTargetingBehaviour;
|
||||
import com.simibubi.create.content.logistics.trains.management.schedule.Schedule;
|
||||
import com.simibubi.create.content.logistics.trains.management.schedule.ScheduleItem;
|
||||
import com.simibubi.create.content.logistics.trains.track.AbstractBogeyTileEntity;
|
||||
import com.simibubi.create.content.logistics.trains.track.AbstractBogeyBlockEntity;
|
||||
import com.simibubi.create.foundation.advancement.AllAdvancements;
|
||||
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
||||
import com.simibubi.create.foundation.blockEntity.BlockEntityBehaviour;
|
||||
@ -285,7 +285,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||
if (!(blockState.getBlock() instanceof AbstractBogeyBlock<?> bogey))
|
||||
continue;
|
||||
BlockEntity be = level.getBlockEntity(bogeyPos);
|
||||
if (!(be instanceof AbstractBogeyTileEntity oldTE))
|
||||
if (!(be instanceof AbstractBogeyBlockEntity oldTE))
|
||||
continue;
|
||||
CompoundTag oldData = oldTE.getBogeyData();
|
||||
BlockState newBlock = bogey.getNextSize(oldTE);
|
||||
@ -294,7 +294,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||
.withStyle(ChatFormatting.RED), true);
|
||||
level.setBlock(bogeyPos, newBlock, 3);
|
||||
BlockEntity newEntity = level.getBlockEntity(bogeyPos);
|
||||
if (!(newEntity instanceof AbstractBogeyTileEntity newTE))
|
||||
if (!(newEntity instanceof AbstractBogeyBlockEntity newTE))
|
||||
continue;
|
||||
newTE.setBogeyData(oldData);
|
||||
bogey.playRotateSound(level, bogeyPos);
|
||||
@ -636,7 +636,7 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||
AbstractBogeyBlock<?> typeOfFirstBogey = bogeyTypes[bogeyIndex];
|
||||
boolean firstBogeyIsUpsideDown = upsideDownBogeys[bogeyIndex];
|
||||
BlockPos firstBogeyPos = contraption.anchor;
|
||||
AbstractBogeyTileEntity firstBogeyTileEntity = (AbstractBogeyTileEntity) level.getBlockEntity(firstBogeyPos);
|
||||
AbstractBogeyBlockEntity firstBogeyTileEntity = (AbstractBogeyBlockEntity) level.getBlockEntity(firstBogeyPos);
|
||||
CarriageBogey firstBogey =
|
||||
new CarriageBogey(typeOfFirstBogey, firstBogeyIsUpsideDown, firstBogeyTileEntity.getBogeyData(), points.get(pointIndex), points.get(pointIndex + 1));
|
||||
CarriageBogey secondBogey = null;
|
||||
@ -650,8 +650,8 @@ public class StationBlockEntity extends SmartBlockEntity implements ITransformab
|
||||
contraptions.size() + 1);
|
||||
return;
|
||||
}
|
||||
AbstractBogeyTileEntity secondBogeyTileEntity =
|
||||
(AbstractBogeyTileEntity) level.getBlockEntity(secondBogeyPos);
|
||||
AbstractBogeyBlockEntity secondBogeyTileEntity =
|
||||
(AbstractBogeyBlockEntity) level.getBlockEntity(secondBogeyPos);
|
||||
bogeySpacing = bogeyLocations[bogeyIndex + 1] - bogeyLocations[bogeyIndex];
|
||||
secondBogey = new CarriageBogey(bogeyTypes[bogeyIndex + 1], upsideDownBogeys[bogeyIndex + 1], secondBogeyTileEntity.getBogeyData(),
|
||||
points.get(pointIndex + 2), points.get(pointIndex + 3));
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.simibubi.create.content.logistics.trains.track;
|
||||
|
||||
import static com.simibubi.create.content.logistics.trains.entity.CarriageBogey.UPSIDE_DOWN_KEY;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.simibubi.create.AllBogeyStyles;
|
||||
import com.simibubi.create.content.logistics.trains.AbstractBogeyBlock;
|
||||
import com.simibubi.create.content.logistics.trains.entity.BogeyStyle;
|
||||
import com.simibubi.create.foundation.tileEntity.CachedRenderBBTileEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.CachedRenderBBBlockEntity;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
|
||||
@ -14,17 +18,14 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static com.simibubi.create.content.logistics.trains.entity.CarriageBogey.UPSIDE_DOWN_KEY;
|
||||
|
||||
public abstract class AbstractBogeyTileEntity extends CachedRenderBBTileEntity {
|
||||
public abstract class AbstractBogeyBlockEntity extends CachedRenderBBBlockEntity {
|
||||
public static final String BOGEY_STYLE_KEY = "BogeyStyle";
|
||||
public static final String BOGEY_DATA_KEY = "BogeyData";
|
||||
|
||||
private CompoundTag bogeyData;
|
||||
|
||||
public AbstractBogeyTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
public AbstractBogeyBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user