mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Trains the name
- Fixed name and other train settings not being updated clientside - Fixed copycats losing their texture on flywheel contraptions - Fixed not being able to order a package item in the stock keeper screen
This commit is contained in:
parent
9cc6f3316e
commit
8151708ab2
10 changed files with 31 additions and 18 deletions
|
@ -1,2 +1,2 @@
|
|||
// 1.21.1 2025-01-26T10:17:25.947287965 Curios for create
|
||||
// 1.21.1 2025-02-02T12:32:00.8366482 Curios for create
|
||||
4346f33a498b3b430f1c4d978e8121dd6bb996c3 data/create/curios/entities/players.json
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
// 1.21.1 2025-01-31T16:32:01.068935352 Tags for minecraft:enchantment mod id create
|
||||
// 1.21.1 2025-02-02T12:32:00.8391558 Tags for minecraft:enchantment mod id create
|
||||
7a2f1612bcbf260055ae80377f4e5761f8367a2e data/minecraft/tags/enchantment/in_enchanting_table.json
|
||||
7a2f1612bcbf260055ae80377f4e5761f8367a2e data/minecraft/tags/enchantment/non_treasure.json
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
// 1.21.1 2025-01-26T10:17:25.947982724 Data Maps
|
||||
// 1.21.1 2025-02-02T12:32:00.9119595 Data Maps
|
||||
037a93758a98377e8b7bb36cc140d4ab3842b181 data/neoforge/data_maps/block/oxidizables.json
|
||||
3e7e7659355104c0bafb76c3e7617eecc42d8ff4 data/neoforge/data_maps/block/waxables.json
|
||||
|
|
|
@ -45,6 +45,7 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import net.neoforged.neoforge.client.model.data.ModelData;
|
||||
|
||||
public class ContraptionVisual<E extends AbstractContraptionEntity> extends AbstractEntityVisual<E> implements DynamicVisual, TickableVisual, LightUpdatedVisual, ShaderLightVisual {
|
||||
protected static final int LIGHT_PADDING = 1;
|
||||
|
@ -88,6 +89,13 @@ public class ContraptionVisual<E extends AbstractContraptionEntity> extends Abst
|
|||
public BlockState getBlockState(BlockPos pos) {
|
||||
return blocks.lookup().apply(pos);
|
||||
}
|
||||
@Override
|
||||
public ModelData getModelData(BlockPos pos) {
|
||||
BlockEntity blockEntity = getBlockEntity(pos);
|
||||
if (blockEntity == null)
|
||||
return super.getModelData(pos);
|
||||
return blockEntity.getModelData();
|
||||
}
|
||||
};
|
||||
|
||||
model = new MultiBlockModelBuilder(modelWorld, blocks.positions())
|
||||
|
|
|
@ -55,7 +55,7 @@ public class BigItemStack {
|
|||
if (obj == this)
|
||||
return true;
|
||||
if (obj instanceof BigItemStack other)
|
||||
return Objects.equals(stack, other.stack) && count == other.count;
|
||||
return ItemStack.isSameItemSameComponents(stack, other.stack) && count == other.count;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public class TrainHUD {
|
|||
if (promptSize > 1) {
|
||||
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(promptSize / -2f + 91, -27, 100);
|
||||
poseStack.translate(promptSize / -2f + 91, -27, 0);
|
||||
|
||||
AllGuiTextures.TRAIN_PROMPT_L.render(guiGraphics, -3, 0);
|
||||
AllGuiTextures.TRAIN_PROMPT_R.render(guiGraphics, promptSize, 0);
|
||||
|
|
|
@ -173,7 +173,7 @@ public class Train {
|
|||
this.icon = icon;
|
||||
this.mapColorIndex = mapColorIndex;
|
||||
this.stress = new double[carriageSpacing.size()];
|
||||
this.name = CreateLang.translateDirect("train.unnamed");
|
||||
this.name = name;
|
||||
this.status = new TrainStatus(this);
|
||||
this.doubleEnded = doubleEnded;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import net.minecraft.network.codec.StreamCodec;
|
|||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -47,6 +47,20 @@ public abstract class TrainEditPacket implements CustomPacketPayload {
|
|||
factory
|
||||
);
|
||||
}
|
||||
|
||||
public void handleSided(Player sender) {
|
||||
Level level = sender == null ? null : sender.level();
|
||||
Train train = Create.RAILWAYS.sided(level).trains.get(id);
|
||||
if (train == null)
|
||||
return;
|
||||
if (!name.isBlank()) {
|
||||
train.name = Component.literal(name);
|
||||
}
|
||||
train.icon = TrainIconType.byId(iconType);
|
||||
train.mapColorIndex = mapColor;
|
||||
if (sender != null)
|
||||
CatnipServices.NETWORK.sendToAllClients(new TrainEditReturnPacket(id, name, iconType, mapColor));
|
||||
}
|
||||
|
||||
public static class Serverbound extends TrainEditPacket implements ServerboundPacketPayload {
|
||||
public static final StreamCodec<ByteBuf, Serverbound> STREAM_CODEC = codec(Serverbound::new);
|
||||
|
@ -57,17 +71,7 @@ public abstract class TrainEditPacket implements CustomPacketPayload {
|
|||
|
||||
@Override
|
||||
public void handle(ServerPlayer sender) {
|
||||
Level level = sender == null ? null : sender.level();
|
||||
Train train = Create.RAILWAYS.sided(level).trains.get(id);
|
||||
if (train == null)
|
||||
return;
|
||||
if (!name.isBlank()) {
|
||||
train.name = Component.literal(name);
|
||||
}
|
||||
train.icon = TrainIconType.byId(iconType);
|
||||
train.mapColorIndex = mapColor;
|
||||
if (sender != null)
|
||||
CatnipServices.NETWORK.sendToAllClients(new TrainEditReturnPacket(id, name, iconType, mapColor));
|
||||
handleSided(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,6 +90,7 @@ public abstract class TrainEditPacket implements CustomPacketPayload {
|
|||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void handle(LocalPlayer player) {
|
||||
handleSided(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue