onBlockActivated shenanigans

This commit is contained in:
raoulvdberge
2019-12-19 22:49:10 +01:00
parent 4e83a3997d
commit de063bb86e
32 changed files with 102 additions and 152 deletions

View File

@@ -15,6 +15,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
@@ -95,13 +96,13 @@ public class StorageMonitorNetworkNode extends NetworkNode implements IComparabl
return true;
}
public boolean deposit(PlayerEntity player, ItemStack toInsert) {
public ActionResultType deposit(PlayerEntity player, ItemStack toInsert) {
if (network == null) {
return false;
return ActionResultType.FAIL; // TODO Correct?
}
if (!network.getSecurityManager().hasPermission(Permission.INSERT, player)) {
return false;
return ActionResultType.FAIL; // TODO Correct?
}
ItemStack filter = itemFilter.getStackInSlot(0);
@@ -112,7 +113,7 @@ public class StorageMonitorNetworkNode extends NetworkNode implements IComparabl
deposits.put(player.getGameProfile().getName(), Pair.of(toInsert, System.currentTimeMillis()));
}
return true;
return ActionResultType.SUCCESS;
}
public void extract(PlayerEntity player, Direction side) {

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -86,7 +87,7 @@ public class ConstructorBlock extends CableBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -99,7 +100,7 @@ public class ConstructorBlock extends CableBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
@@ -106,7 +107,7 @@ public class ControllerBlock extends BaseBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -125,6 +126,6 @@ public class ControllerBlock extends BaseBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -13,6 +13,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -56,7 +57,7 @@ public class CrafterBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -69,7 +70,7 @@ public class CrafterBlock extends NetworkNodeBlock {
), Permission.MODIFY, Permission.AUTOCRAFTING);
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -39,7 +40,7 @@ public class CrafterManagerBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -48,7 +49,7 @@ public class CrafterManagerBlock extends NetworkNodeBlock {
), Permission.MODIFY, Permission.AUTOCRAFTING);
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -11,6 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -40,7 +41,7 @@ public class CraftingMonitorBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
CraftingMonitorTile tile = (CraftingMonitorTile) world.getTileEntity(pos);
@@ -51,7 +52,7 @@ public class CraftingMonitorBlock extends NetworkNodeBlock {
), Permission.MODIFY, Permission.AUTOCRAFTING);
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -84,7 +85,7 @@ public class DestructorBlock extends CableBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -97,7 +98,7 @@ public class DestructorBlock extends CableBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -13,6 +13,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -67,7 +68,7 @@ public class DetectorBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -80,7 +81,7 @@ public class DetectorBlock extends NetworkNodeBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
@Nullable

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -40,7 +41,7 @@ public class DiskDriveBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, rayTraceResult.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -53,6 +54,6 @@ public class DiskDriveBlock extends NetworkNodeBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -35,7 +36,7 @@ public class DiskManipulatorBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTraceResult) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, rayTraceResult.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -48,7 +49,7 @@ public class DiskManipulatorBlock extends NetworkNodeBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -107,7 +108,7 @@ public class ExporterBlock extends CableBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -120,6 +121,6 @@ public class ExporterBlock extends CableBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -13,6 +13,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -87,7 +88,7 @@ public class ExternalStorageBlock extends CableBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -100,7 +101,7 @@ public class ExternalStorageBlock extends CableBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -11,6 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -36,7 +37,7 @@ public class FluidInterfaceBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -49,7 +50,7 @@ public class FluidInterfaceBlock extends NetworkNodeBlock {
), Permission.MODIFY, Permission.INSERT, Permission.EXTRACT);
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -14,6 +14,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -62,7 +63,7 @@ public class FluidStorageBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui((ServerPlayerEntity) player, new PositionalTileContainerProvider<FluidStorageTile>(
((FluidStorageTile) world.getTileEntity(pos)).getNode().getTitle(),
@@ -71,6 +72,6 @@ public class FluidStorageBlock extends NetworkNodeBlock {
), pos));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -11,6 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -48,11 +49,11 @@ public class GridBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> API.instance().getGridManager().openGrid(GridBlockGridFactory.ID, (ServerPlayerEntity) player, pos));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -107,7 +108,7 @@ public class ImporterBlock extends CableBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -120,6 +121,6 @@ public class ImporterBlock extends CableBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -11,6 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -36,7 +37,7 @@ public class InterfaceBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -49,7 +50,7 @@ public class InterfaceBlock extends NetworkNodeBlock {
), Permission.MODIFY, Permission.INSERT, Permission.EXTRACT);
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -35,7 +36,7 @@ public class NetworkTransmitterBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -48,7 +49,7 @@ public class NetworkTransmitterBlock extends NetworkNodeBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -17,6 +17,7 @@ import net.minecraft.state.BooleanProperty;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -75,14 +76,14 @@ public class PortableGridBlock extends BaseBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
if (!world.isRemote) {
API.instance().getGridManager().openGrid(PortableGridBlockGridFactory.ID, (ServerPlayerEntity) player, pos);
((PortableGridTile) world.getTileEntity(pos)).onOpened();
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -35,7 +36,7 @@ public class RelayBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -48,7 +49,7 @@ public class RelayBlock extends NetworkNodeBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -11,6 +11,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -35,7 +36,7 @@ public class SecurityManagerBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
Runnable action = () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -54,7 +55,7 @@ public class SecurityManagerBlock extends NetworkNodeBlock {
}
}
return true;
return ActionResultType.SUCCESS;
}
@Nullable

View File

@@ -14,6 +14,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -62,7 +63,7 @@ public class StorageBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui((ServerPlayerEntity) player, new PositionalTileContainerProvider<StorageTile>(
((StorageTile) world.getTileEntity(pos)).getNode().getTitle(),
@@ -71,6 +72,6 @@ public class StorageBlock extends NetworkNodeBlock {
), pos));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -13,6 +13,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@@ -44,7 +45,7 @@ public class StorageMonitorBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
ItemStack held = player.inventory.getCurrentItem();
@@ -69,7 +70,7 @@ public class StorageMonitorBlock extends NetworkNodeBlock {
}
}
return true;
return ActionResultType.SUCCESS;
}
@Override

View File

@@ -12,6 +12,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
@@ -67,7 +68,7 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock {
@Override
@SuppressWarnings("deprecation")
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
public ActionResultType func_225533_a_(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player,
@@ -80,6 +81,6 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock {
));
}
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -1,77 +0,0 @@
package com.raoulvdberge.refinedstorage.render.model;
import com.raoulvdberge.refinedstorage.RS;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.texture.ISprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import javax.annotation.Nullable;
import java.util.*;
import java.util.function.Function;
public class ModelDiskManipulator implements IUnbakedModel {
private static final ResourceLocation MODEL_BASE_CUTOUT = new ResourceLocation(RS.ID + ":block/cube_north_cutout");
private static final ResourceLocation MODEL_BASE_CONNECTED = new ResourceLocation(RS.ID + ":block/disk_manipulator_connected");
private static final ResourceLocation MODEL_BASE_DISCONNECTED = new ResourceLocation(RS.ID + ":block/disk_manipulator_disconnected");
private static final ResourceLocation MODEL_DISK = new ResourceLocation(RS.ID + ":block/disks/disk");
private static final ResourceLocation MODEL_DISK_NEAR_CAPACITY = new ResourceLocation(RS.ID + ":block/disks/disk_near_capacity");
private static final ResourceLocation MODEL_DISK_FULL = new ResourceLocation(RS.ID + ":block/disks/disk_full");
private static final ResourceLocation MODEL_DISK_DISCONNECTED = new ResourceLocation(RS.ID + ":block/disks/disk_disconnected");
@Override
public Collection<ResourceLocation> getDependencies() {
List<ResourceLocation> dependencies = new ArrayList<>();
dependencies.add(MODEL_BASE_CUTOUT);
dependencies.add(MODEL_BASE_CONNECTED);
dependencies.add(MODEL_BASE_DISCONNECTED);
dependencies.add(MODEL_DISK);
dependencies.add(MODEL_DISK_NEAR_CAPACITY);
dependencies.add(MODEL_DISK_FULL);
dependencies.add(MODEL_DISK_DISCONNECTED);
return dependencies;
}
@Override
public Collection<ResourceLocation> getTextures(Function<ResourceLocation, IUnbakedModel> modelGetter, Set<String> missingTextureErrors) {
return Collections.emptyList();
}
@Nullable
@Override
public IBakedModel bake(ModelBakery bakery, Function spriteGetter, ISprite sprite, VertexFormat format) {
IModel baseModelConnected, baseModelDisconnected;
IModel diskModel;
IModel diskModelNearCapacity;
IModel diskModelFull;
IModel diskModelDisconnected;
try {
baseModelConnected = ModelLoaderRegistry.getModel(MODEL_BASE_CONNECTED);
baseModelDisconnected = ModelLoaderRegistry.getModel(MODEL_BASE_DISCONNECTED);
diskModel = ModelLoaderRegistry.getModel(MODEL_DISK);
diskModelNearCapacity = ModelLoaderRegistry.getModel(MODEL_DISK_NEAR_CAPACITY);
diskModelFull = ModelLoaderRegistry.getModel(MODEL_DISK_FULL);
diskModelDisconnected = ModelLoaderRegistry.getModel(MODEL_DISK_DISCONNECTED);
} catch (Exception e) {
throw new Error("Unable to load disk manipulator models", e);
}
/*
return new BakedModelDiskManipulator(
new BakedModelFullbright(baseModelConnected.bake(bakery, spriteGetter, sprite, format), RS.ID + ":blocks/disk_manipulator/cutouts/connected"),
baseModelDisconnected.bake(bakery, spriteGetter, sprite, format),
new BakedModelFullbright(diskModel.bake(bakery, spriteGetter, sprite, format), RS.ID + ":blocks/disks/leds").setCacheDisabled(),
new BakedModelFullbright(diskModelNearCapacity.bake(bakery, spriteGetter, sprite, format), RS.ID + ":blocks/disks/leds").setCacheDisabled(),
new BakedModelFullbright(diskModelFull.bake(bakery, spriteGetter, sprite, format), RS.ID + ":blocks/disks/leds").setCacheDisabled(),
diskModelDisconnected.bake(bakery, spriteGetter, sprite, format)
);*/
return null;
}
}

View File

@@ -1,6 +1,7 @@
package com.raoulvdberge.refinedstorage.render.model;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
@@ -28,7 +29,7 @@ import java.util.Random;
// for those wondering TRSR stands for Translation Rotation Scale Rotation
public class TRSRBakedModel implements IBakedModel {
protected final IBakedModel original;
protected TRSRTransformation transformation;
protected MatrixStack transformation;
private final int faceOffset;
public TRSRBakedModel(IBakedModel original, float x, float y, float z, float scale) {
@@ -40,7 +41,7 @@ public class TRSRBakedModel implements IBakedModel {
}
public TRSRBakedModel(IBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ) {
this(original, new TRSRTransformation(new Vector3f(x, y, z),
this(original, new MatrixStack(new Vector3f(x, y, z),
null,
new Vector3f(scaleX, scaleY, scaleZ),
TRSRTransformation.quatFromXYZ(rotX, rotY, rotZ)));

View File

@@ -1,6 +1,6 @@
package com.raoulvdberge.refinedstorage.screen;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CrafterManagerNetworkNode;
@@ -19,11 +19,10 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.glfw.GLFW;
import yalter.mousetweaks.api.MouseTweaksDisableWheelTweak;
import java.util.Map;
@MouseTweaksDisableWheelTweak
// TODO @MouseTweaksDisableWheelTweak
public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> implements IScreenInfoProvider {
private CrafterManagerNetworkNode crafterManager;
@@ -120,8 +119,8 @@ public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> im
int y = heading.getValue();
if (y >= getTopHeight() - 1 && y < getTopHeight() + getVisibleRows() * 18 - 1) {
GlStateManager.disableLighting();
GlStateManager.color3f(1, 1, 1);
RenderSystem.disableLighting();
RenderSystem.color3f(1, 1, 1);
bindTexture(RS.ID, "gui/crafter_manager.png");

View File

@@ -2,6 +2,7 @@ package com.raoulvdberge.refinedstorage.screen;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingRequestInfo;
@@ -82,7 +83,7 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
} else {
fluidDrawer.draw(x, y, requested.getFluid());
GlStateManager.enableAlphaTest();
RenderSystem.enableAlphaTest();
}
}
}

View File

@@ -120,7 +120,7 @@ public class FluidGridStack implements IGridStack {
if (cachedTags == null) {
cachedTags = new HashSet<>();
for (ResourceLocation owningTag : FluidTags.getCollection().getOwningTags(stack.getFluid())) {
for (ResourceLocation owningTag : FluidTags.func_226157_a_().getOwningTags(stack.getFluid())) {
cachedTags.add(owningTag.getPath());
}
}

View File

@@ -1,6 +1,7 @@
package com.raoulvdberge.refinedstorage.screen.widget;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.network.grid.IGridTab;
import com.raoulvdberge.refinedstorage.apiimpl.render.ElementDrawers;
@@ -125,7 +126,7 @@ public class TabListWidget {
int tx = x + getXOffset() + ((IGridTab.TAB_WIDTH + 1) * num);
int ty = y;
GlStateManager.enableAlphaTest();
RenderSystem.enableAlphaTest();
gui.bindTexture(RS.ID, "icons.png");

View File

@@ -7,6 +7,7 @@ import com.raoulvdberge.refinedstorage.api.network.security.Permission;
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -36,13 +37,13 @@ public class NetworkUtils {
return null;
}
public static boolean attemptModify(World world, BlockPos pos, Direction facing, PlayerEntity player, Runnable action) {
public static ActionResultType attemptModify(World world, BlockPos pos, Direction facing, PlayerEntity player, Runnable action) {
return attempt(world, pos, facing, player, action, Permission.MODIFY);
}
public static boolean attempt(World world, BlockPos pos, Direction facing, PlayerEntity player, Runnable action, Permission... permissionsRequired) {
public static ActionResultType attempt(World world, BlockPos pos, Direction facing, PlayerEntity player, Runnable action, Permission... permissionsRequired) {
if (world.isRemote) {
return true;
return ActionResultType.SUCCESS;
}
INetwork network = getNetworkFromNode(getNodeFromTile(world.getTileEntity(pos)));
@@ -52,13 +53,13 @@ public class NetworkUtils {
if (!network.getSecurityManager().hasPermission(permission, player)) {
WorldUtils.sendNoPermissionMessage(player);
return true;
return ActionResultType.SUCCESS;
}
}
}
action.run();
return true;
return ActionResultType.SUCCESS;
}
}

View File

@@ -1,7 +1,7 @@
package com.raoulvdberge.refinedstorage.util;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.raoulvdberge.refinedstorage.api.util.IComparer;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.render.Styles;
@@ -118,10 +118,10 @@ public final class RenderUtils {
float textScale = Minecraft.getInstance().getForceUnicodeFont() ? 1F : 0.7F;
// RS END
GlStateManager.disableRescaleNormal();
RenderSystem.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableDepthTest();
RenderSystem.disableLighting();
RenderSystem.disableDepthTest();
int tooltipTextWidth = 0;
for (String textLine : textLines) {
@@ -201,8 +201,8 @@ public final class RenderUtils {
// RS BEGIN
if (showSmallText) {
GlStateManager.pushMatrix();
GlStateManager.scalef(textScale, textScale, 1);
RenderSystem.pushMatrix();
RenderSystem.scalef(textScale, textScale, 1);
int y = tooltipTop + tooltipHeight - 6;
@@ -217,14 +217,14 @@ public final class RenderUtils {
y -= 9;
}
GlStateManager.popMatrix();
RenderSystem.popMatrix();
}
// RS END
GlStateManager.enableLighting();
GlStateManager.enableDepthTest();
RenderSystem.enableLighting();
RenderSystem.enableDepthTest();
RenderHelper.enableStandardItemLighting();
GlStateManager.enableRescaleNormal();
RenderSystem.enableRescaleNormal();
}
}