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.inventory.InventoryHelper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -95,13 +96,13 @@ public class StorageMonitorNetworkNode extends NetworkNode implements IComparabl
return true; return true;
} }
public boolean deposit(PlayerEntity player, ItemStack toInsert) { public ActionResultType deposit(PlayerEntity player, ItemStack toInsert) {
if (network == null) { if (network == null) {
return false; return ActionResultType.FAIL; // TODO Correct?
} }
if (!network.getSecurityManager().hasPermission(Permission.INSERT, player)) { if (!network.getSecurityManager().hasPermission(Permission.INSERT, player)) {
return false; return ActionResultType.FAIL; // TODO Correct?
} }
ItemStack filter = itemFilter.getStackInSlot(0); 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())); deposits.put(player.getGameProfile().getName(), Pair.of(toInsert, System.currentTimeMillis()));
} }
return true; return ActionResultType.SUCCESS;
} }
public void extract(PlayerEntity player, Direction side) { 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.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -86,7 +87,7 @@ public class ConstructorBlock extends CableBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (ServerPlayerEntity) player,
@@ -99,7 +100,7 @@ public class ConstructorBlock extends CableBlock {
)); ));
} }
return true; return ActionResultType.SUCCESS;
} }
@Override @Override

View File

@@ -18,6 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -106,7 +107,7 @@ public class ControllerBlock extends BaseBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (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.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@@ -56,7 +57,7 @@ public class CrafterBlock extends NetworkNodeBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (ServerPlayerEntity) player,
@@ -69,7 +70,7 @@ public class CrafterBlock extends NetworkNodeBlock {
), Permission.MODIFY, Permission.AUTOCRAFTING); ), Permission.MODIFY, Permission.AUTOCRAFTING);
} }
return true; return ActionResultType.SUCCESS;
} }
@Override @Override

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,6 +10,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -107,7 +108,7 @@ public class ExporterBlock extends CableBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (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.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -87,7 +88,7 @@ public class ExternalStorageBlock extends CableBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (ServerPlayerEntity) player,
@@ -100,7 +101,7 @@ public class ExternalStorageBlock extends CableBlock {
)); ));
} }
return true; return ActionResultType.SUCCESS;
} }
@Override @Override

View File

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

View File

@@ -14,6 +14,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@@ -62,7 +63,7 @@ public class FluidStorageBlock extends NetworkNodeBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui((ServerPlayerEntity) player, new PositionalTileContainerProvider<FluidStorageTile>( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui((ServerPlayerEntity) player, new PositionalTileContainerProvider<FluidStorageTile>(
((FluidStorageTile) world.getTileEntity(pos)).getNode().getTitle(), ((FluidStorageTile) world.getTileEntity(pos)).getNode().getTitle(),
@@ -71,6 +72,6 @@ public class FluidStorageBlock extends NetworkNodeBlock {
), pos)); ), 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.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@@ -48,11 +49,11 @@ public class GridBlock extends NetworkNodeBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> API.instance().getGridManager().openGrid(GridBlockGridFactory.ID, (ServerPlayerEntity) player, pos)); 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.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -107,7 +108,7 @@ public class ImporterBlock extends CableBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (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.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@@ -36,7 +37,7 @@ public class InterfaceBlock extends NetworkNodeBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attempt(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (ServerPlayerEntity) player,
@@ -49,7 +50,7 @@ public class InterfaceBlock extends NetworkNodeBlock {
), Permission.MODIFY, Permission.INSERT, Permission.EXTRACT); ), Permission.MODIFY, Permission.INSERT, Permission.EXTRACT);
} }
return true; return ActionResultType.SUCCESS;
} }
@Override @Override

View File

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

View File

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

View File

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

View File

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

View File

@@ -14,6 +14,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@@ -62,7 +63,7 @@ public class StorageBlock extends NetworkNodeBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui((ServerPlayerEntity) player, new PositionalTileContainerProvider<StorageTile>( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui((ServerPlayerEntity) player, new PositionalTileContainerProvider<StorageTile>(
((StorageTile) world.getTileEntity(pos)).getNode().getTitle(), ((StorageTile) world.getTileEntity(pos)).getNode().getTitle(),
@@ -71,6 +72,6 @@ public class StorageBlock extends NetworkNodeBlock {
), pos)); ), 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.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
@@ -44,7 +45,7 @@ public class StorageMonitorBlock extends NetworkNodeBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
ItemStack held = player.inventory.getCurrentItem(); ItemStack held = player.inventory.getCurrentItem();
@@ -69,7 +70,7 @@ public class StorageMonitorBlock extends NetworkNodeBlock {
} }
} }
return true; return ActionResultType.SUCCESS;
} }
@Override @Override

View File

@@ -12,6 +12,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -67,7 +68,7 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock {
@Override @Override
@SuppressWarnings("deprecation") @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) { if (!world.isRemote) {
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui( return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
(ServerPlayerEntity) player, (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; package com.raoulvdberge.refinedstorage.render.model;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel; 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 // for those wondering TRSR stands for Translation Rotation Scale Rotation
public class TRSRBakedModel implements IBakedModel { public class TRSRBakedModel implements IBakedModel {
protected final IBakedModel original; protected final IBakedModel original;
protected TRSRTransformation transformation; protected MatrixStack transformation;
private final int faceOffset; private final int faceOffset;
public TRSRBakedModel(IBakedModel original, float x, float y, float z, float scale) { 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) { 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, null,
new Vector3f(scaleX, scaleY, scaleZ), new Vector3f(scaleX, scaleY, scaleZ),
TRSRTransformation.quatFromXYZ(rotX, rotY, rotZ))); TRSRTransformation.quatFromXYZ(rotX, rotY, rotZ)));

View File

@@ -1,6 +1,6 @@
package com.raoulvdberge.refinedstorage.screen; 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.RS;
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
import com.raoulvdberge.refinedstorage.apiimpl.network.node.CrafterManagerNetworkNode; 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.inventory.container.Slot;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import yalter.mousetweaks.api.MouseTweaksDisableWheelTweak;
import java.util.Map; import java.util.Map;
@MouseTweaksDisableWheelTweak // TODO @MouseTweaksDisableWheelTweak
public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> implements IScreenInfoProvider { public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> implements IScreenInfoProvider {
private CrafterManagerNetworkNode crafterManager; private CrafterManagerNetworkNode crafterManager;
@@ -120,8 +119,8 @@ public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> im
int y = heading.getValue(); int y = heading.getValue();
if (y >= getTopHeight() - 1 && y < getTopHeight() + getVisibleRows() * 18 - 1) { if (y >= getTopHeight() - 1 && y < getTopHeight() + getVisibleRows() * 18 - 1) {
GlStateManager.disableLighting(); RenderSystem.disableLighting();
GlStateManager.color3f(1, 1, 1); RenderSystem.color3f(1, 1, 1);
bindTexture(RS.ID, "gui/crafter_manager.png"); 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.google.common.collect.Lists;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.raoulvdberge.refinedstorage.RS; import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement; import com.raoulvdberge.refinedstorage.api.autocrafting.craftingmonitor.ICraftingMonitorElement;
import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingRequestInfo; import com.raoulvdberge.refinedstorage.api.autocrafting.task.ICraftingRequestInfo;
@@ -82,7 +83,7 @@ public class CraftingMonitorScreen extends BaseScreen<CraftingMonitorContainer>
} else { } else {
fluidDrawer.draw(x, y, requested.getFluid()); fluidDrawer.draw(x, y, requested.getFluid());
GlStateManager.enableAlphaTest(); RenderSystem.enableAlphaTest();
} }
} }
} }

View File

@@ -120,7 +120,7 @@ public class FluidGridStack implements IGridStack {
if (cachedTags == null) { if (cachedTags == null) {
cachedTags = new HashSet<>(); 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()); cachedTags.add(owningTag.getPath());
} }
} }

View File

@@ -1,6 +1,7 @@
package com.raoulvdberge.refinedstorage.screen.widget; package com.raoulvdberge.refinedstorage.screen.widget;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.raoulvdberge.refinedstorage.RS; import com.raoulvdberge.refinedstorage.RS;
import com.raoulvdberge.refinedstorage.api.network.grid.IGridTab; import com.raoulvdberge.refinedstorage.api.network.grid.IGridTab;
import com.raoulvdberge.refinedstorage.apiimpl.render.ElementDrawers; import com.raoulvdberge.refinedstorage.apiimpl.render.ElementDrawers;
@@ -125,7 +126,7 @@ public class TabListWidget {
int tx = x + getXOffset() + ((IGridTab.TAB_WIDTH + 1) * num); int tx = x + getXOffset() + ((IGridTab.TAB_WIDTH + 1) * num);
int ty = y; int ty = y;
GlStateManager.enableAlphaTest(); RenderSystem.enableAlphaTest();
gui.bindTexture(RS.ID, "icons.png"); 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 com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -36,13 +37,13 @@ public class NetworkUtils {
return null; 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); 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) { if (world.isRemote) {
return true; return ActionResultType.SUCCESS;
} }
INetwork network = getNetworkFromNode(getNodeFromTile(world.getTileEntity(pos))); INetwork network = getNetworkFromNode(getNodeFromTile(world.getTileEntity(pos)));
@@ -52,13 +53,13 @@ public class NetworkUtils {
if (!network.getSecurityManager().hasPermission(permission, player)) { if (!network.getSecurityManager().hasPermission(permission, player)) {
WorldUtils.sendNoPermissionMessage(player); WorldUtils.sendNoPermissionMessage(player);
return true; return ActionResultType.SUCCESS;
} }
} }
} }
action.run(); action.run();
return true; return ActionResultType.SUCCESS;
} }
} }

View File

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