3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00

Implement EndGateway state

Dieser Commit ist enthalten in:
Matthew 2016-03-16 20:50:55 -04:00 committet von md_5
Ursprung 6efa87306b
Commit da444904c2
3 geänderte Dateien mit 52 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -272,6 +272,8 @@ public class CraftBlock implements Block {
return new CraftDispenser(this);
case DROPPER:
return new CraftDropper(this);
case END_GATEWAY:
return new CraftEndGateway(this);
case HOPPER:
return new CraftHopper(this);
case MOB_SPAWNER:

Datei anzeigen

@ -0,0 +1,40 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityEndGateway;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.EndGateway;
import org.bukkit.craftbukkit.CraftWorld;
public class CraftEndGateway extends CraftBlockState implements EndGateway {
private TileEntityEndGateway gateway;
public CraftEndGateway(Block block) {
super(block);
CraftWorld world = (CraftWorld) block.getWorld();
gateway = (TileEntityEndGateway) world.getTileEntityAt(getX(), getY(), getZ());
}
public CraftEndGateway(final Material material, TileEntityEndGateway te) {
super(material);
this.gateway = te;
}
@Override
public boolean update(boolean force, boolean applyPhysics) {
boolean result = super.update(force, applyPhysics);
if (result) {
gateway.update();
}
return result;
}
@Override
public TileEntityEndGateway getTileEntity() {
return gateway;
}
}

Datei anzeigen

@ -15,6 +15,7 @@ import net.minecraft.server.TileEntityChest;
import net.minecraft.server.TileEntityCommand;
import net.minecraft.server.TileEntityDispenser;
import net.minecraft.server.TileEntityDropper;
import net.minecraft.server.TileEntityEndGateway;
import net.minecraft.server.TileEntityFurnace;
import net.minecraft.server.TileEntityHopper;
import net.minecraft.server.TileEntityMobSpawner;
@ -34,6 +35,7 @@ import org.bukkit.craftbukkit.block.CraftCommandBlock;
import org.bukkit.craftbukkit.block.CraftCreatureSpawner;
import org.bukkit.craftbukkit.block.CraftDispenser;
import org.bukkit.craftbukkit.block.CraftDropper;
import org.bukkit.craftbukkit.block.CraftEndGateway;
import org.bukkit.craftbukkit.block.CraftFurnace;
import org.bukkit.craftbukkit.block.CraftHopper;
import org.bukkit.craftbukkit.block.CraftJukebox;
@ -222,6 +224,11 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
te = new TileEntityDispenser();
}
return new CraftDropper(material, (TileEntityDropper) te);
case END_GATEWAY:
if (te == null) {
te = new TileEntityEndGateway();
}
return new CraftEndGateway(material, (TileEntityEndGateway) te);
case HOPPER:
if (te == null) {
te = new TileEntityHopper();
@ -304,6 +311,9 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
case DROPPER:
valid = te instanceof TileEntityDropper;
break;
case END_GATEWAY:
valid = te instanceof TileEntityEndGateway;
break;
case HOPPER:
valid = te instanceof TileEntityHopper;
break;