Migrations

This commit is contained in:
Sebastian Hartte
2020-06-27 16:18:20 +02:00
parent d638d083c2
commit ba71a82288
303 changed files with 1216 additions and 1210 deletions
@@ -18,7 +18,7 @@
package appeng.debug;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import appeng.block.AEBaseTileBlock;
@@ -20,10 +20,10 @@ package appeng.debug;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -38,14 +38,14 @@ public class CubeGeneratorBlock extends AEBaseTileBlock<CubeGeneratorTileEntity>
}
@Override
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
final CubeGeneratorTileEntity tcg = this.getTileEntity(w, pos);
if (tcg != null) {
tcg.click(player);
}
return ActionResultType.SUCCESS;
return ActionResult.SUCCESS;
}
}
@@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.StringTextComponent;
@@ -26,8 +26,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
@@ -58,9 +58,9 @@ public class DebugCardItem extends AEBaseItem {
}
@Override
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
public ActionResult onItemUseFirst(ItemStack stack, ItemUseContext context) {
if (context.getWorld().isRemote()) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
PlayerEntity player = context.getPlayer();
@@ -69,7 +69,7 @@ public class DebugCardItem extends AEBaseItem {
Direction side = context.getFace();
if (player == null) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
if (player.isCrouching()) {
@@ -182,7 +182,7 @@ public class DebugCardItem extends AEBaseItem {
}
}
}
return ActionResultType.SUCCESS;
return ActionResult.SUCCESS;
}
private void outputMsg(final Entity player, final String string) {
@@ -7,8 +7,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.text.StringTextComponent;
@@ -35,34 +35,34 @@ public class DebugPartPlacerItem extends AEBaseItem {
}
@Override
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
public ActionResult onItemUseFirst(ItemStack stack, ItemUseContext context) {
World world = context.getWorld();
if (world.isRemote()) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
PlayerEntity player = context.getPlayer();
BlockPos pos = context.getPos();
if (player == null) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
if (!player.abilities.isCreativeMode) {
player.sendMessage(new StringTextComponent("Only usable in creative mode"));
return ActionResultType.FAIL;
return ActionResult.FAIL;
}
TileEntity te = world.getTileEntity(pos);
if (!(te instanceof IPartHost)) {
player.sendMessage(new StringTextComponent("Right-click something that will accept parts"));
return ActionResultType.FAIL;
return ActionResult.FAIL;
}
IPartHost center = (IPartHost) te;
IPart cable = center.getPart(AEPartLocation.INTERNAL);
if (cable == null) {
player.sendMessage(new StringTextComponent("Clicked part host must have an INSIDE part"));
return ActionResultType.FAIL;
return ActionResult.FAIL;
}
Direction face = context.getFace();
@@ -101,7 +101,7 @@ public class DebugPartPlacerItem extends AEBaseItem {
}
}
return ActionResultType.SUCCESS;
return ActionResult.SUCCESS;
}
}
@@ -18,7 +18,7 @@
package appeng.debug;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import appeng.block.AEBaseTileBlock;
@@ -25,7 +25,7 @@ import com.google.common.math.IntMath;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
+5 -5
View File
@@ -29,7 +29,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -47,9 +47,9 @@ public class EraserItem extends AEBaseItem {
}
@Override
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
public ActionResult onItemUseFirst(ItemStack stack, ItemUseContext context) {
if (context.getWorld().isRemote()) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
final PlayerEntity player = context.getPlayer();
@@ -57,7 +57,7 @@ public class EraserItem extends AEBaseItem {
final BlockPos pos = context.getPos();
if (player == null) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
final Block state = world.getBlockState(pos).getBlock();
@@ -101,7 +101,7 @@ public class EraserItem extends AEBaseItem {
AELog.info("Delete " + blocks + " blocks");
return ActionResultType.SUCCESS;
return ActionResult.SUCCESS;
}
private boolean isInsideBox(BlockPos pos, BlockPos origin) {
+1 -1
View File
@@ -18,7 +18,7 @@
package appeng.debug;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import appeng.block.AEBaseTileBlock;
@@ -28,7 +28,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.Direction;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
@@ -22,10 +22,10 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.play.server.SChunkDataPacket;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
@@ -51,14 +51,14 @@ public class MeteoritePlacerItem extends AEBaseItem {
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
public TypedActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
if (world.isRemote()) {
return ActionResult.resultPass(player.getHeldItem(hand));
return TypedActionResult.resultPass(player.getHeldItem(hand));
}
if (player.isSneaking()) {
final ItemStack itemStack = player.getHeldItem(hand);
final CompoundNBT tag = itemStack.getOrCreateTag();
final CompoundTag tag = itemStack.getOrCreateTag();
if (tag.contains(MODE_TAG)) {
final byte mode = tag.getByte("mode");
@@ -71,16 +71,16 @@ public class MeteoritePlacerItem extends AEBaseItem {
player.sendMessage(new StringTextComponent(craterType.name()));
return ActionResult.resultSuccess(itemStack);
return TypedActionResult.resultSuccess(itemStack);
}
return super.onItemRightClick(world, player, hand);
}
@Override
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
public ActionResult onItemUseFirst(ItemStack stack, ItemUseContext context) {
if (context.getWorld().isRemote()) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
ServerPlayerEntity player = (ServerPlayerEntity) context.getPlayer();
@@ -88,10 +88,10 @@ public class MeteoritePlacerItem extends AEBaseItem {
BlockPos pos = context.getPos();
if (player == null) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
CompoundNBT tag = stack.getOrCreateTag();
CompoundTag tag = stack.getOrCreateTag();
if (!tag.contains(MODE_TAG)) {
tag.putByte(MODE_TAG, (byte) CraterType.NORMAL.ordinal());
}
@@ -107,7 +107,7 @@ public class MeteoritePlacerItem extends AEBaseItem {
if (spawned == null) {
player.sendMessage(new StringTextComponent("Un-suitable Location."));
return ActionResultType.FAIL;
return ActionResult.FAIL;
}
// Since we don't know yet if the meteorite will be underground or not,
@@ -131,6 +131,6 @@ public class MeteoritePlacerItem extends AEBaseItem {
player.connection.sendPacket(new SChunkDataPacket(c, 65535)); // 65535 == full chunk
});
return ActionResultType.SUCCESS;
return ActionResult.SUCCESS;
}
}
@@ -20,10 +20,10 @@ package appeng.debug;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -38,11 +38,11 @@ public class PhantomNodeBlock extends AEBaseTileBlock<PhantomNodeTileEntity> {
}
@Override
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
final PhantomNodeTileEntity tpn = this.getTileEntity(w, pos);
tpn.triggerCrashMode();
return ActionResultType.SUCCESS;
return ActionResult.SUCCESS;
}
}
@@ -21,7 +21,7 @@ package appeng.debug;
import java.util.EnumSet;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.Direction;
import appeng.api.networking.IGridNode;
import appeng.api.util.AEPartLocation;
@@ -24,10 +24,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.StringTextComponent;
@@ -49,9 +49,9 @@ public class ReplicatorCardItem extends AEBaseItem {
}
@Override
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
public ActionResult onItemUseFirst(ItemStack stack, ItemUseContext context) {
if (context.getWorld().isRemote()) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
PlayerEntity player = context.getPlayer();
@@ -61,7 +61,7 @@ public class ReplicatorCardItem extends AEBaseItem {
Hand hand = context.getHand();
if (player == null) {
return ActionResultType.PASS;
return ActionResult.PASS;
}
int x = pos.getX();
@@ -70,7 +70,7 @@ public class ReplicatorCardItem extends AEBaseItem {
if (player.isCrouching()) {
if (world.getTileEntity(pos) instanceof IGridHost) {
final CompoundNBT tag = new CompoundNBT();
final CompoundTag tag = new CompoundTag();
tag.putInt("x", x);
tag.putInt("y", y);
tag.putInt("z", z);
@@ -81,7 +81,7 @@ public class ReplicatorCardItem extends AEBaseItem {
this.outputMsg(player, "This is not a Grid Tile.");
}
} else {
final CompoundNBT ish = player.getHeldItem(hand).getTag();
final CompoundTag ish = player.getHeldItem(hand).getTag();
if (ish != null) {
final int src_x = ish.getInt("x");
final int src_y = ish.getInt("y");
@@ -133,7 +133,7 @@ public class ReplicatorCardItem extends AEBaseItem {
if (blk != null && blk.hasTileEntity(state)) {
final TileEntity ote = src_w.getTileEntity(p);
final TileEntity nte = blk.createTileEntity(state, world);
final CompoundNBT data = new CompoundNBT();
final CompoundTag data = new CompoundTag();
ote.write(data);
nte.read(data.copy());
world.setTileEntity(d, nte);
@@ -158,7 +158,7 @@ public class ReplicatorCardItem extends AEBaseItem {
this.outputMsg(player, "No Source Defined");
}
}
return ActionResultType.SUCCESS;
return ActionResult.SUCCESS;
}
private void outputMsg(final Entity player, final String string) {