|
|
@@ -4,6 +4,7 @@ import com.hexdragon.blacksmithre.registry.RegMain;
|
|
|
import net.minecraft.block.*;
|
|
|
import net.minecraft.block.material.Material;
|
|
|
import net.minecraft.block.material.MaterialColor;
|
|
|
+import net.minecraft.inventory.container.Container;
|
|
|
import net.minecraft.item.BlockItem;
|
|
|
import net.minecraft.item.Item;
|
|
|
import net.minecraft.item.ItemGroup;
|
|
|
@@ -27,26 +28,8 @@ public class NetheriteAnvil extends AnvilBlock {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //设置红石比较器输出
|
|
|
- public boolean hasComparatorInputOverride(BlockState state) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {
|
|
|
- AnvilTileEntity tileEntity = (AnvilTileEntity) worldIn.getTileEntity(pos);
|
|
|
-
|
|
|
- //@see Container.calcRedstoneFromInventory()
|
|
|
- int i = 0;
|
|
|
- float f = 0.0F;
|
|
|
+ // 设置红石比较器输出
|
|
|
+ public boolean hasComparatorInputOverride(BlockState state) {return true;}
|
|
|
+ public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {return Container.calcRedstone(worldIn.getTileEntity(pos));}
|
|
|
|
|
|
- for(int j = 0; j < tileEntity.getSizeInventory(); ++j) {
|
|
|
- ItemStack itemstack = tileEntity.inventory.get(j);
|
|
|
- if (!itemstack.isEmpty()) {
|
|
|
- f += (float)itemstack.getCount() / (float)itemstack.getMaxStackSize();
|
|
|
- ++i;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- f = f / (float)tileEntity.getSizeInventory();
|
|
|
- return MathHelper.floor(f * 14.0F) + (i > 0 ? 1 : 0);
|
|
|
- }
|
|
|
}
|