-Fixed rendering bug for packager

-Added texture for aura core
-Fixed collision box of packager
This commit is contained in:
makeo committed 2015-12-01 21:12:03 +01:00
1 parent 32a69727b3
commit 83bd63153d
9 files changed
+111 -37

No files matched your search

@@ -16,7 +16,7 @@ public class ModelPackagerPiston extends ModelBase {
ModelRenderer shape1;
ModelRenderer shape2;
public ModelPackagerPiston()
public ModelPackagerPiston(boolean cut)
{
textureWidth = 64;
textureHeight = 32;
@@ -26,9 +26,10 @@ public class ModelPackagerPiston extends ModelBase {
shape1.setRotationPoint(-5F, 16F, -5F);
shape1.setTextureSize(64, 32);
shape1.mirror = true;
shape2 = new ModelRenderer(this, 41, 0);
shape2 = new ModelRenderer(this, 41, cut ? 1 : 0);
shape2.addBox(0F, 0F, 0F, 4, 4, 4);
shape2.setRotationPoint(-2F, 12F, -2F);
shape2.setRotationPoint(-2F, cut ? 13F : 12F, -2F);
shape2.setTextureSize(64, 32);
shape2.mirror = true;
}
@@ -23,7 +23,8 @@ public class RenderTileArcanePackager extends TileEntitySpecialRenderer {
private static final ModelArcanePackager MODEL = new ModelArcanePackager();
private static final ResourceLocation TEXTURE_PISTON = new SimpleResourceLocation("/models/packager_piston.png");
private static final ModelPackagerPiston MODEL_PISTON = new ModelPackagerPiston();
private static final ModelPackagerPiston MODEL_PISTON = new ModelPackagerPiston(false);
private static final ModelPackagerPiston MODEL_PISTON_CUT = new ModelPackagerPiston(true);
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
@@ -49,13 +50,20 @@ public class RenderTileArcanePackager extends TileEntitySpecialRenderer {
}
GL11.glTranslatef(0, pistonOffset, 0);
bindTexture(TEXTURE_PISTON);
MODEL_PISTON.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
bindTexture(TEXTURE_PISTON);
if(pistonOffset < 1/16f) {
MODEL_PISTON_CUT.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
} else {
MODEL_PISTON.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
}
GL11.glPopMatrix();
bindTexture(TEXTURE);
MODEL.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glDisable(GL11.GL_BLEND);
@@ -275,12 +275,12 @@ public class BlockStoneMachine extends Block {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 11 || metadata == 15 || metadata == 1) {
setBlockBounds(0, 0, 0, 1, 1, 1);
} else if (metadata == 0 || metadata == 3) {
setBlockBoundsBasedOnState(world, x, y, z);
} else if(metadata == 2) {
setBlockBounds(3 / 16f, 0, 3 / 16f, 1 - (3 / 16f), 9.5f/16f, 1 - (3 / 16f));
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
setBlockBoundsBasedOnState(world, x, y, z);
} else {
setBlockBoundsBasedOnState(world, x, y, z);
}
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, entity);
}
@@ -1,14 +1,19 @@
package makeo.gadomancy.common.items;
import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.registration.RegisteredItems;
import makeo.gadomancy.common.utils.NBTHelper;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.blocks.BlockCustomOreItem;
import java.util.List;
@@ -52,16 +57,55 @@ public class ItemAuraCore extends Item {
}
}
public void setCoreType(ItemStack itemStack, AuraCoreType type) {
if(itemStack == null || !(itemStack.getItem() instanceof ItemAuraCore)) return;
if(type == null) return;
NBTHelper.getData(itemStack).setInteger("type", type.ordinal());
private IIcon coreBlankIcon;
private IIcon coreIcon;
private IIcon borderIcon;
@Override
public void registerIcons(IIconRegister ir) {
coreBlankIcon = ir.registerIcon(Gadomancy.MODID + ":core_core_blank");
coreIcon = ir.registerIcon(Gadomancy.MODID + ":core_core");
borderIcon = ir.registerIcon(Gadomancy.MODID + ":core_border");
}
@Override
public IIcon getIcon(ItemStack stack, int pass) {
//shhhhh don't tell it anyone!
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(getCoreType(stack) == AuraCoreType.BLANK && pass == 0) {
return coreBlankIcon;
}
return pass == 0 ? coreIcon : borderIcon;
}
@Override
public boolean requiresMultipleRenderPasses() {
return true;
}
@Override
public int getColorFromItemStack(ItemStack stack, int pass) {
if(pass == 0) {
AuraCoreType type = getCoreType(stack);
if(type.isAspect()) {
if(type.ordinal() < 7) {
return BlockCustomOreItem.colors[type.ordinal()];
}
return type.getAspect().getColor();
}
}
return super.getColorFromItemStack(stack, pass);
}
public ItemStack setCoreType(ItemStack itemStack, AuraCoreType type) {
itemStack.setItemDamage(type.ordinal());
return itemStack;
}
public AuraCoreType getCoreType(ItemStack itemStack) {
if(itemStack == null || !(itemStack.getItem() instanceof ItemAuraCore)) return null;
int ordinal = NBTHelper.getData(itemStack).getInteger("type");
return AuraCoreType.values()[ordinal];
return AuraCoreType.values()[itemStack.getItemDamage()];
}
public boolean isBlank(ItemStack itemStack) {
@@ -70,26 +114,49 @@ public class ItemAuraCore extends Item {
}
public static enum AuraCoreType {
BLANK("blank"),
BLANK("Blank", "blank"),
AIR(Aspect.AIR),
FIRE(Aspect.FIRE, true),
WATER(Aspect.WATER, true),
EARTH(Aspect.EARTH, true),
ORDER(Aspect.ORDER),
ENTROPY(Aspect.ENTROPY, true);
AIR("Aer", "aer"),
FIRE("Ignis", "ignis"),
WATER("Aqua", "aqua"),
EARTH("Terra", "terra"),
ORDER("Ordo", "ordo"),
ENTROPY("Perditio", "perditio");
private final Aspect aspect;
private final String unlocName;
private final boolean unused;
public final String unlocName, fallback;
AuraCoreType(String unlocName) {
this.unlocName = unlocName;
this.aspect = null;
this.unused = false;
}
AuraCoreType(String fallback, String unlocName) {
this.unlocName = "gadomancy.auracore." + unlocName;
this.fallback = fallback;
AuraCoreType(Aspect aspect) {
this(aspect, false);
}
AuraCoreType(Aspect aspect, boolean unused) {
this.aspect = aspect;
this.unlocName = null;
this.unused = unused;
}
public boolean isAspect() {
return aspect != null;
}
public Aspect getAspect() {
return aspect;
}
public String getLocalizedName() {
return StatCollector.canTranslate(unlocName) ? StatCollector.translateToLocal(unlocName) : fallback;
String name = isAspect() ? aspect.getName() : StatCollector.translateToLocal("gadomancy.auracore." + unlocName);
if(unused) {
name += " " + StatCollector.translateToLocal("gadomancy.auracore.unused");
}
return name;
}
}
}
@@ -150,13 +150,8 @@ tile.BlockAuraPylon.1.name=Aura Pylon Peak
gadomancy.nodes.GROWING=Growing
gadomancy.nodes.STARVING=Starving
gadomancy.auracore.unused=(Unused at the moment)
gadomancy.auracore.blank=Blank
gadomancy.auracore.aer=Aer
gadomancy.auracore.ignis=Ignis (Unused at the moment)
gadomancy.auracore.aqua=Aqua (Unused at the moment)
gadomancy.auracore.terra=Terra (Unused at the moment)
gadomancy.auracore.ordo=Ordo
gadomancy.auracore.perditio=Perditio (Unused at the moment)
gadomancy.aura.research.unlock=You've researched the aura of %s
Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@@ -0,0 +1,3 @@
{
"animation": {}
}