|
@@ -24,7 +24,6 @@ import net.minecraft.util.ResourceLocation;
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
import net.minecraft.util.text.StringTextComponent;
|
|
|
import net.minecraft.world.IWorld;
|
|
|
-import net.minecraft.world.World;
|
|
|
|
|
|
public class BlockCommands {
|
|
|
|
|
@@ -241,39 +240,6 @@ public class BlockCommands {
|
|
|
stack.setCount(InventoryUtils.removeFromInventory((ChestTileEntity) te, stack));
|
|
|
return stack;
|
|
|
});
|
|
|
- sm.registerConsumer("block.grow", (sc, in) -> {
|
|
|
- Location l1 = (Location) in[0].get(sc);
|
|
|
- World w = l1.getWorld().getWorld();
|
|
|
- BlockPos pos1 = l1.getBlockPos();
|
|
|
- BlockPos pos2 = ((Location) in[1].get(sc)).getBlockPos();
|
|
|
-
|
|
|
- int x = Math.min(pos1.getX(), pos2.getX());
|
|
|
- int endX = Math.max(pos1.getX(), pos2.getX());
|
|
|
-
|
|
|
- int y = Math.min(pos1.getY(), pos2.getY());
|
|
|
- int endY = Math.max(pos1.getY(), pos2.getY());
|
|
|
-
|
|
|
- int z = Math.min(pos1.getZ(), pos2.getZ());
|
|
|
- int endZ = Math.max(pos1.getZ(), pos2.getZ());
|
|
|
-
|
|
|
- if(endX - x > 50 || endY - y > 50 || endZ - z > 50) {
|
|
|
- throw new IllegalArgumentException("uhh, that area seems way to big for growing plants");
|
|
|
- }
|
|
|
-
|
|
|
- BlockPos relative;
|
|
|
- BlockState state;
|
|
|
- for(; x <= endX; x++) {
|
|
|
- for(; y <= endY; y++) {
|
|
|
- for(; z <= endZ; z++) {
|
|
|
- relative = new BlockPos(x, y, z);
|
|
|
- state = w.getBlockState(relative);
|
|
|
- if(state.getBlock() instanceof CropsBlock) {
|
|
|
- w.setBlockState(relative, state.with(CropsBlock.AGE, 7));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
sm.registerConsumer("block.setspawnertype", (sc, in) -> {
|
|
|
Location l = (Location) in[0].get(sc);
|
|
|
MobSpawnerTileEntity spawner = (MobSpawnerTileEntity) l.getWorld().getTileEntity(l.getBlockPos());
|