aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch187
1 files changed, 187 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch
new file mode 100644
index 0000000000..9f3903592e
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java.patch
@@ -0,0 +1,187 @@
+--- a/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java
++++ b/net/minecraft/world/entity/vehicle/MinecartCommandBlock.java
+@@ -8,7 +8,7 @@
+ import net.minecraft.network.syncher.EntityDataSerializers;
+ import net.minecraft.network.syncher.SynchedEntityData;
+ import net.minecraft.server.level.ServerLevel;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.InteractionResult;
+ import net.minecraft.world.entity.EntityType;
+ import net.minecraft.world.entity.player.Player;
+@@ -17,33 +17,31 @@
+ import net.minecraft.world.level.BaseCommandBlock;
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.Blocks;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.phys.Vec3;
+
+ public class MinecartCommandBlock extends AbstractMinecart {
+
+- static final EntityDataAccessor<String> DATA_ID_COMMAND_NAME = SynchedEntityData.defineId(MinecartCommandBlock.class, EntityDataSerializers.STRING);
++ public static final EntityDataAccessor<String> DATA_ID_COMMAND_NAME = SynchedEntityData.defineId(MinecartCommandBlock.class, EntityDataSerializers.STRING);
+ static final EntityDataAccessor<Component> DATA_ID_LAST_OUTPUT = SynchedEntityData.defineId(MinecartCommandBlock.class, EntityDataSerializers.COMPONENT);
+- private final BaseCommandBlock commandBlock = new MinecartCommandBlock.MinecartCommandBase();
++ private final BaseCommandBlock commandBlock = new MinecartCommandBlock.a();
+ private static final int ACTIVATION_DELAY = 4;
+ private int lastActivated;
+
+- public MinecartCommandBlock(EntityType<? extends MinecartCommandBlock> entitytype, Level level) {
+- super(entitytype, level);
++ public MinecartCommandBlock(EntityType<? extends MinecartCommandBlock> entityType, Level level) {
++ super(entityType, level);
+ }
+
+- public MinecartCommandBlock(Level level, double d0, double d1, double d2) {
+- super(EntityType.COMMAND_BLOCK_MINECART, level, d0, d1, d2);
++ public MinecartCommandBlock(Level level, double x, double d1, double y) {
++ super(EntityType.COMMAND_BLOCK_MINECART, level, x, d1, y);
+ }
+
+ @Override
+- @Override
+ protected Item getDropItem() {
+ return Items.MINECART;
+ }
+
+ @Override
+- @Override
+ protected void defineSynchedData() {
+ super.defineSynchedData();
+ this.getEntityData().define(MinecartCommandBlock.DATA_ID_COMMAND_NAME, "");
+@@ -51,30 +49,26 @@
+ }
+
+ @Override
+- @Override
+- protected void readAdditionalSaveData(CompoundTag compoundtag) {
+- super.readAdditionalSaveData(compoundtag);
+- this.commandBlock.load(compoundtag);
++ protected void readAdditionalSaveData(CompoundTag compound) {
++ super.readAdditionalSaveData(compound);
++ this.commandBlock.load(compound);
+ this.getEntityData().set(MinecartCommandBlock.DATA_ID_COMMAND_NAME, this.getCommandBlock().getCommand());
+ this.getEntityData().set(MinecartCommandBlock.DATA_ID_LAST_OUTPUT, this.getCommandBlock().getLastOutput());
+ }
+
+ @Override
+- @Override
+- protected void addAdditionalSaveData(CompoundTag compoundtag) {
+- super.addAdditionalSaveData(compoundtag);
+- this.commandBlock.save(compoundtag);
++ protected void addAdditionalSaveData(CompoundTag compound) {
++ super.addAdditionalSaveData(compound);
++ this.commandBlock.save(compound);
+ }
+
+ @Override
+- @Override
+- public AbstractMinecart.Type getMinecartType() {
+- return AbstractMinecart.Type.COMMAND_BLOCK;
++ public AbstractMinecart.EnumMinecartType getMinecartType() {
++ return AbstractMinecart.EnumMinecartType.COMMAND_BLOCK;
+ }
+
+ @Override
+- @Override
+- public BlockState getDefaultDisplayBlockState() {
++ public IBlockData getDefaultDisplayBlockState() {
+ return Blocks.COMMAND_BLOCK.defaultBlockState();
+ }
+
+@@ -83,9 +77,8 @@
+ }
+
+ @Override
+- @Override
+- public void activateMinecart(int i, int j, int k, boolean flag) {
+- if (flag && this.tickCount - this.lastActivated >= 4) {
++ public void activateMinecart(int x, int y, int z, boolean receivingPower) {
++ if (receivingPower && this.tickCount - this.lastActivated >= 4) {
+ this.getCommandBlock().performCommand(this.level());
+ this.lastActivated = this.tickCount;
+ }
+@@ -93,52 +86,46 @@
+ }
+
+ @Override
+- @Override
+- public InteractionResult interact(Player player, InteractionHand interactionhand) {
++ public InteractionResult interact(Player player, EnumHand hand) {
+ return this.commandBlock.usedBy(player);
+ }
+
+ @Override
+- @Override
+- public void onSyncedDataUpdated(EntityDataAccessor<?> entitydataaccessor) {
+- super.onSyncedDataUpdated(entitydataaccessor);
+- if (MinecartCommandBlock.DATA_ID_LAST_OUTPUT.equals(entitydataaccessor)) {
++ public void onSyncedDataUpdated(EntityDataAccessor<?> key) {
++ super.onSyncedDataUpdated(key);
++ if (MinecartCommandBlock.DATA_ID_LAST_OUTPUT.equals(key)) {
+ try {
+ this.commandBlock.setLastOutput((Component) this.getEntityData().get(MinecartCommandBlock.DATA_ID_LAST_OUTPUT));
+ } catch (Throwable throwable) {
+ ;
+ }
+- } else if (MinecartCommandBlock.DATA_ID_COMMAND_NAME.equals(entitydataaccessor)) {
++ } else if (MinecartCommandBlock.DATA_ID_COMMAND_NAME.equals(key)) {
+ this.commandBlock.setCommand((String) this.getEntityData().get(MinecartCommandBlock.DATA_ID_COMMAND_NAME));
+ }
+
+ }
+
+ @Override
+- @Override
+ public boolean onlyOpCanSetNbt() {
+ return true;
+ }
+
+- public class MinecartCommandBase extends BaseCommandBlock {
++ public class a extends BaseCommandBlock {
+
+- public MinecartCommandBase() {}
++ public a() {}
+
+ @Override
+- @Override
+ public ServerLevel getLevel() {
+ return (ServerLevel) MinecartCommandBlock.this.level();
+ }
+
+ @Override
+- @Override
+ public void onUpdated() {
+ MinecartCommandBlock.this.getEntityData().set(MinecartCommandBlock.DATA_ID_COMMAND_NAME, this.getCommand());
+ MinecartCommandBlock.this.getEntityData().set(MinecartCommandBlock.DATA_ID_LAST_OUTPUT, this.getLastOutput());
+ }
+
+ @Override
+- @Override
+ public Vec3 getPosition() {
+ return MinecartCommandBlock.this.position();
+ }
+@@ -148,15 +135,20 @@
+ }
+
+ @Override
+- @Override
+ public CommandSourceStack createCommandSourceStack() {
+ return new CommandSourceStack(this, MinecartCommandBlock.this.position(), MinecartCommandBlock.this.getRotationVector(), this.getLevel(), 2, this.getName().getString(), MinecartCommandBlock.this.getDisplayName(), this.getLevel().getServer(), MinecartCommandBlock.this);
+ }
+
+ @Override
+- @Override
+ public boolean isValid() {
+ return !MinecartCommandBlock.this.isRemoved();
+ }
++
++ // CraftBukkit start
++ @Override
++ public org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper) {
++ return (org.bukkit.craftbukkit.entity.CraftMinecartCommand) MinecartCommandBlock.this.getBukkitEntity();
++ }
++ // CraftBukkit end
+ }
+ }