Move to RenderType from BlockRenderLayer, isSneaking -> isCrouching
This commit is contained in:
@@ -8,6 +8,7 @@ import com.raoulvdberge.refinedstorage.api.network.item.INetworkItemProvider;
|
||||
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -31,7 +32,9 @@ public class NetworkItemManager implements INetworkItemManager {
|
||||
((IWirelessTransmitter) node).getDimension() == player.dimension) {
|
||||
IWirelessTransmitter transmitter = (IWirelessTransmitter) node;
|
||||
|
||||
double distance = Math.sqrt(Math.pow(transmitter.getOrigin().getX() - player.posX, 2) + Math.pow(transmitter.getOrigin().getY() - player.posY, 2) + Math.pow(transmitter.getOrigin().getZ() - player.posZ, 2));
|
||||
Vec3d pos = player.getPositionVec();
|
||||
|
||||
double distance = Math.sqrt(Math.pow(transmitter.getOrigin().getX() - pos.getX(), 2) + Math.pow(transmitter.getOrigin().getY() - pos.getY(), 2) + Math.pow(transmitter.getOrigin().getZ() - pos.getZ(), 2));
|
||||
|
||||
if (distance < transmitter.getRange()) {
|
||||
inRange = true;
|
||||
|
@@ -126,7 +126,7 @@ public class StorageMonitorNetworkNode extends NetworkNode implements IComparabl
|
||||
|
||||
ItemStack filter = itemFilter.getStackInSlot(0);
|
||||
|
||||
int toExtract = player.isSneaking() ? 1 : 64;
|
||||
int toExtract = player.isCrouching() ? 1 : 64;
|
||||
|
||||
if (!filter.isEmpty()) {
|
||||
ItemStack result = network.extractItem(filter, toExtract, compare, Action.PERFORM);
|
||||
|
@@ -82,6 +82,8 @@ public class ConstructorBlock extends CableBlock {
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
|
@@ -18,7 +18,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -79,11 +78,6 @@ public class ControllerBlock extends BaseBlock {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state) {
|
||||
return true;
|
||||
|
@@ -30,11 +30,6 @@ public class CrafterBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "crafter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.ANY_FACE_PLAYER;
|
||||
|
@@ -27,11 +27,6 @@ public class CrafterManagerBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "crafter_manager");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.HORIZONTAL;
|
||||
|
@@ -28,11 +28,6 @@ public class CraftingMonitorBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "crafting_monitor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.HORIZONTAL;
|
||||
|
@@ -52,12 +52,6 @@ public class DetectorBlock extends NetworkNodeBlock {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean canProvidePower(BlockState state) {
|
||||
|
@@ -28,11 +28,6 @@ public class DiskManipulatorBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "disk_manipulator");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
|
@@ -31,11 +31,6 @@ public class GridBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, type == GridType.NORMAL ? "grid" : type.getName() + "_grid");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.HORIZONTAL;
|
||||
|
@@ -23,11 +23,6 @@ public class NetworkReceiverBlock extends NetworkNodeBlock {
|
||||
return new NetworkReceiverTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
|
@@ -28,11 +28,6 @@ public class NetworkTransmitterBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "network_transmitter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
|
@@ -28,11 +28,6 @@ public class RelayBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "relay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
|
@@ -29,11 +29,6 @@ public class SecurityManagerBlock extends NetworkNodeBlock {
|
||||
this.setRegistryName(RS.ID, "security_manager");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockDirection getDirection() {
|
||||
return BlockDirection.HORIZONTAL;
|
||||
|
@@ -48,7 +48,7 @@ public class StorageMonitorBlock extends NetworkNodeBlock {
|
||||
if (!world.isRemote) {
|
||||
ItemStack held = player.inventory.getCurrentItem();
|
||||
|
||||
if (player.isSneaking()) {
|
||||
if (player.isCrouching()) {
|
||||
return NetworkUtils.attemptModify(world, pos, hit.getFace(), player, () -> NetworkHooks.openGui(
|
||||
(ServerPlayerEntity) player,
|
||||
new PositionalTileContainerProvider<StorageMonitorTile>(
|
||||
|
@@ -49,11 +49,6 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConnectedState() {
|
||||
return true;
|
||||
@@ -71,6 +66,8 @@ public class WirelessTransmitterBlock extends NetworkNodeBlock {
|
||||
return facing == Direction.DOWN && !this.isValidPosition(state, world, currentPos) ? Blocks.AIR.getDefaultState() : super.updatePostPlacement(state, facing, facingState, world, currentPos, facingPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
|
@@ -51,7 +51,7 @@ public class FilterItem extends Item {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if (!world.isRemote) {
|
||||
if (player.isSneaking()) {
|
||||
if (player.isCrouching()) {
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.FILTER));
|
||||
}
|
||||
|
||||
|
@@ -84,7 +84,7 @@ public class FluidStorageDiskItem extends Item implements IStorageDiskProvider {
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||
ItemStack diskStack = player.getHeldItem(hand);
|
||||
|
||||
if (!world.isRemote && player.isSneaking() && type != FluidStorageType.CREATIVE) {
|
||||
if (!world.isRemote && player.isCrouching() && type != FluidStorageType.CREATIVE) {
|
||||
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).getByStack(diskStack);
|
||||
|
||||
if (disk != null && disk.getStored() == 0) {
|
||||
|
@@ -126,7 +126,7 @@ public class PatternItem extends Item implements ICraftingPatternProvider {
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||
if (!world.isRemote && player.isSneaking()) {
|
||||
if (!world.isRemote && player.isCrouching()) {
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, new ItemStack(RSItems.PATTERN, player.getHeldItem(hand).getCount()));
|
||||
}
|
||||
|
||||
|
@@ -84,7 +84,7 @@ public class StorageDiskItem extends Item implements IStorageDiskProvider {
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||
ItemStack diskStack = player.getHeldItem(hand);
|
||||
|
||||
if (!world.isRemote && player.isSneaking() && type != ItemStorageType.CREATIVE) {
|
||||
if (!world.isRemote && player.isCrouching() && type != ItemStorageType.CREATIVE) {
|
||||
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).getByStack(diskStack);
|
||||
|
||||
if (disk != null && disk.getStored() == 0) {
|
||||
|
@@ -20,7 +20,7 @@ public class WrenchItem extends Item {
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext ctx) {
|
||||
if (!ctx.getPlayer().isSneaking()) {
|
||||
if (!ctx.getPlayer().isCrouching()) {
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
|
@@ -69,7 +69,7 @@ public class FluidStorageBlockItem extends BaseBlockItem {
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||
ItemStack storageStack = player.getHeldItem(hand);
|
||||
|
||||
if (!world.isRemote && player.isSneaking() && type != FluidStorageType.CREATIVE) {
|
||||
if (!world.isRemote && player.isCrouching() && type != FluidStorageType.CREATIVE) {
|
||||
UUID diskId = null;
|
||||
IStorageDisk disk = null;
|
||||
|
||||
|
@@ -66,7 +66,7 @@ public class PortableGridBlockItem extends EnergyBlockItem {
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUse(ItemUseContext context) {
|
||||
if (!context.getPlayer().isSneaking()) {
|
||||
if (!context.getPlayer().isCrouching()) {
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
|
@@ -68,7 +68,7 @@ public class StorageBlockItem extends BaseBlockItem {
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
|
||||
ItemStack storageStack = player.getHeldItem(hand);
|
||||
|
||||
if (!world.isRemote && player.isSneaking() && type != ItemStorageType.CREATIVE) {
|
||||
if (!world.isRemote && player.isCrouching() && type != ItemStorageType.CREATIVE) {
|
||||
UUID diskId = null;
|
||||
IStorageDisk disk = null;
|
||||
|
||||
|
@@ -1,9 +1,6 @@
|
||||
package com.raoulvdberge.refinedstorage.setup;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.RSContainers;
|
||||
import com.raoulvdberge.refinedstorage.RSItems;
|
||||
import com.raoulvdberge.refinedstorage.RSKeyBindings;
|
||||
import com.raoulvdberge.refinedstorage.*;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.container.CrafterContainer;
|
||||
import com.raoulvdberge.refinedstorage.container.CrafterManagerContainer;
|
||||
@@ -20,6 +17,8 @@ import com.raoulvdberge.refinedstorage.tile.StorageMonitorTile;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.Slot;
|
||||
import net.minecraft.resources.IReloadableResourceManager;
|
||||
@@ -209,7 +208,27 @@ public class ClientSetup {
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR);
|
||||
ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_PORTABLE_GRID);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(StorageMonitorTile.class, new StorageMonitorTileRenderer());
|
||||
RenderType cutout = RenderType.func_228643_e_();
|
||||
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.CONTROLLER, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.CREATIVE_CONTROLLER, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.CABLE, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTER, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTER_MANAGER, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTING_MONITOR, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.DETECTOR, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.DISK_MANIPULATOR, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.GRID, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.CRAFTING_GRID, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.PATTERN_GRID, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.FLUID_GRID, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.NETWORK_RECEIVER, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.NETWORK_TRANSMITTER, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.RELAY, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.SECURITY_MANAGER, cutout);
|
||||
RenderTypeLookup.setRenderLayer(RSBlocks.WIRELESS_TRANSMITTER, cutout);
|
||||
|
||||
// TODO ClientRegistry.bindTileEntitySpecialRenderer(StorageMonitorTile.class, new StorageMonitorTileRenderer());
|
||||
|
||||
e.getMinecraftSupplier().get().getItemColors().register(new PatternItemColor(), RSItems.PATTERN);
|
||||
}
|
||||
|
Reference in New Issue
Block a user