package client.tesr;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHopper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class TileEntityHopperRenderer extends TileEntitySpecialRenderer<TileEntityHopper>{
public void render(TileEntityHopper te, double x, double y, double z, float partialTicks, int destroyStage, float alpha)
{
BlockPos blockpos=te.getPos();
World worldIn=te.getWorld();
if(worldIn.getBlockState(blockpos).getBlock() instanceof BlockHopper)
{
BlockHopper hopper=(BlockHopper)(worldIn.getBlockState(blockpos).getBlock());
this.setLightmapDisabled(true);
this.drawNameplate(te,"强度:"+Container.calcRedstoneFromInventory(te),x,y,z,12);
this.setLightmapDisabled(false);
}
}
}
代码如上,版本forge1.12.2,已经绑定了漏斗地的e,目的是为了将漏斗的比较器检测强度显示在名字上,进入游戏后发现能显示但强度始终显示为0,想请教一下大佬是哪边的问题?
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockHopper;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class TileEntityHopperRenderer extends TileEntitySpecialRenderer<TileEntityHopper>{
public void render(TileEntityHopper te, double x, double y, double z, float partialTicks, int destroyStage, float alpha)
{
BlockPos blockpos=te.getPos();
World worldIn=te.getWorld();
if(worldIn.getBlockState(blockpos).getBlock() instanceof BlockHopper)
{
BlockHopper hopper=(BlockHopper)(worldIn.getBlockState(blockpos).getBlock());
this.setLightmapDisabled(true);
this.drawNameplate(te,"强度:"+Container.calcRedstoneFromInventory(te),x,y,z,12);
this.setLightmapDisabled(false);
}
}
}
代码如上,版本forge1.12.2,已经绑定了漏斗地的e,目的是为了将漏斗的比较器检测强度显示在名字上,进入游戏后发现能显示但强度始终显示为0,想请教一下大佬是哪边的问题?
逻辑客户端没有逻辑服务器上的数据,所以客户端看不到任何物品。