Fix JABBA-related issues with crafting station slots (#54)

* Fix shift-merging tools voiding items

fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392>

* Change 0-sized ItemStacks into null stacks in crafting station attached slots

Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425>

* Update buildscript

* spotlessApply
This commit is contained in:
Raven Szewczyk authored and GitHub committed 2022-09-22 20:51:23 +02:00
1 parent 18bfeaff32
commit 39be06c23b
571 files changed
+25959 -28223

No files matched your search

+20 -24
View File
@@ -12,35 +12,32 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
public class ItemHelper
{
public static Object getStaticItem (String name, String classPackage)
{
try
{
public class ItemHelper {
public static Object getStaticItem(String name, String classPackage) {
try {
Class clazz = Class.forName(classPackage);
Field field = clazz.getDeclaredField(name);
Object ret = field.get(null);
if (ret != null && (ret instanceof ItemStack || ret instanceof Item))
return ret;
if (ret != null && (ret instanceof ItemStack || ret instanceof Item)) return ret;
return null;
}
catch (Exception e)
{
} catch (Exception e) {
TConstruct.logger.warn("Could not find " + name + "from " + classPackage);
return null;
}
}
public static void addDrops (LivingDropsEvent event, ItemStack dropStack)
{
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
public static void addDrops(LivingDropsEvent event, ItemStack dropStack) {
EntityItem entityitem = new EntityItem(
event.entityLiving.worldObj,
event.entityLiving.posX,
event.entityLiving.posY,
event.entityLiving.posZ,
dropStack);
entityitem.delayBeforeCanPickup = 10;
event.drops.add(entityitem);
}
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
tessellator.startDrawingQuads();
@@ -49,7 +46,8 @@ public class ItemHelper
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, ItemHelper.getIconSafe(block.getIcon(1, meta)));// block.getIcon(1, meta));
renderblocks.renderFaceYPos(
block, 0.0D, 0.0D, 0.0D, ItemHelper.getIconSafe(block.getIcon(1, meta))); // block.getIcon(1, meta));
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
@@ -70,8 +68,7 @@ public class ItemHelper
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
public static void renderInvBlockFace (RenderBlocks renderblocks, Block block, int meta)
{
public static void renderInvBlockFace(RenderBlocks renderblocks, Block block, int meta) {
Tessellator tessellator = Tessellator.instance;
GL11.glScalef(2f, 2f, 2f);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
@@ -104,10 +101,9 @@ public class ItemHelper
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
public static IIcon getIconSafe (IIcon icon)
{
if (icon != null)
return icon;
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
public static IIcon getIconSafe(IIcon icon) {
if (icon != null) return icon;
return ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture))
.getAtlasSprite("missingno");
}
}