mirror of
https://github.com/GTNewHorizons/IguanaTweaksTConstruct.git
synced 2026-11-26 23:03:11 +00:00
Yesss. Buckets.
This commit is contained in:
1 parent
48d5190f0c
commit
edd6c7e59e
9 files changed
+130
-12
No files matched your search
@@ -4,9 +4,11 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import iguanaman.iguanatweakstconstruct.IguanaTweaksTConstruct;
|
||||
import iguanaman.iguanatweakstconstruct.claybuckets.items.ClayBucket;
|
||||
import iguanaman.iguanatweakstconstruct.claybuckets.items.ClayBucketMilk;
|
||||
import iguanaman.iguanatweakstconstruct.claybuckets.items.ClayBucketTinkerLiquids;
|
||||
import iguanaman.iguanatweakstconstruct.claybuckets.items.WearableBucket;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Reference;
|
||||
import iguanaman.iguanatweakstconstruct.util.Log;
|
||||
import mantle.pulsar.pulse.Handler;
|
||||
@@ -37,6 +39,8 @@ public class IguanaItems {
|
||||
public static Item clayBucketMilk;
|
||||
public static Item clayBucketsTinkers;
|
||||
|
||||
public static Item wearableBuckets;
|
||||
|
||||
@Handler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
@@ -58,6 +62,12 @@ public class IguanaItems {
|
||||
GameRegistry.registerItem(clayBucketMilk, "clayBucketMilk");
|
||||
GameRegistry.registerItem(clayBucketsTinkers, "clayBucketsTinkers");
|
||||
|
||||
// secrit bucketssss
|
||||
if(IguanaTweaksTConstruct.isMobHeadsActive) {
|
||||
wearableBuckets = new WearableBucket();
|
||||
GameRegistry.registerItem(wearableBuckets, "wearableBucket");
|
||||
}
|
||||
|
||||
// register milkbucket to the ordictionary
|
||||
OreDictionary.registerOre("listAllmilk", clayBucketMilk); // i suppose this is for pams harvestcraft.
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package iguanaman.iguanatweakstconstruct.claybuckets.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import iguanaman.iguanatweakstconstruct.claybuckets.IguanaItems;
|
||||
import iguanaman.iguanatweakstconstruct.reference.Reference;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WearableBucket extends Item {
|
||||
private static final String[] textureTypes = new String[] {"bucket_helmet", "enderman_jaw"};
|
||||
private IIcon[] icons;
|
||||
|
||||
public WearableBucket() {
|
||||
super();
|
||||
this.setContainerItem(IguanaItems.wearableBuckets);
|
||||
this.setUnlocalizedName(Reference.MOD_ID + ".wearable_bucket");
|
||||
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) {
|
||||
return armorType == 0; // 0 = helmet
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack par1ItemStack)
|
||||
{
|
||||
int i = par1ItemStack.getItemDamage();
|
||||
|
||||
if (i < 0 || i >= textureTypes.length)
|
||||
i = 0;
|
||||
|
||||
return Reference.resource(textureTypes[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int j = 0; j < textureTypes.length; ++j)
|
||||
par3List.add(new ItemStack(par1, 1, j));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
icons = new IIcon[textureTypes.length];
|
||||
|
||||
for (int i = 0; i < textureTypes.length; ++i)
|
||||
icons[i] = par1IconRegister.registerIcon(Reference.resource(textureTypes[i]));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int par1)
|
||||
{
|
||||
if (par1 < 0 || par1 >= textureTypes.length)
|
||||
par1 = 0;
|
||||
|
||||
return icons[par1];
|
||||
}
|
||||
}
|
||||
@@ -44,5 +44,7 @@ public class IguanaMobHeads {
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(new RenderPlayerHandler());
|
||||
|
||||
proxy.postInit();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,24 @@
|
||||
package iguanaman.iguanatweakstconstruct.mobheads.proxy;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import iguanaman.iguanatweakstconstruct.IguanaTweaksTConstruct;
|
||||
import iguanaman.iguanatweakstconstruct.claybuckets.IguanaItems;
|
||||
import iguanaman.iguanatweakstconstruct.mobheads.renderers.IguanaTileEntitySkullRenderer;
|
||||
import iguanaman.iguanatweakstconstruct.mobheads.tileentities.IguanaSkullTileEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MobHeadClientProxy extends MobHeadCommonProxy {
|
||||
@Override
|
||||
public void initialize() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(IguanaSkullTileEntity.class, IguanaTileEntitySkullRenderer.renderer);
|
||||
}
|
||||
|
||||
public void postInit() {
|
||||
// hide secret stuff ;)
|
||||
if(IguanaTweaksTConstruct.isItemsActive)
|
||||
{
|
||||
codechicken.nei.api.API.hideItem(new ItemStack(IguanaItems.wearableBuckets, 1, 0));
|
||||
codechicken.nei.api.API.hideItem(new ItemStack(IguanaItems.wearableBuckets, 1, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,4 +7,6 @@ import net.minecraft.world.World;
|
||||
public class MobHeadCommonProxy {
|
||||
|
||||
public void initialize() {}
|
||||
|
||||
public void postInit() {}
|
||||
}
|
||||
+19
-10
@@ -61,16 +61,26 @@ public class IguanaTileEntitySkullRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
public void renderSkull(float x, float y, float z, float r, int sidePlacement, int meta)
|
||||
{
|
||||
ModelBase model = modelSkull;
|
||||
|
||||
// chose model
|
||||
if(meta == 0)
|
||||
model = modelEnderManHead;
|
||||
if(meta == 1)
|
||||
model = modelZombie;
|
||||
renderSkull(x,y,z, r, sidePlacement, modelEnderManHead, textures[0]);
|
||||
else if(meta == 1)
|
||||
renderSkull(x,y,z, r, sidePlacement, modelZombie, textures[1]);
|
||||
else
|
||||
renderSkull(x,y,z, r, sidePlacement, modelSkull, textures[meta]);
|
||||
}
|
||||
|
||||
public void renderBucket(float x, float y, float z, float r, int sidePlacement, int meta)
|
||||
{
|
||||
if(meta == 0)
|
||||
renderSkull(x,y,z, r, sidePlacement, modelBucketHelmet, textureBucketHelmet);
|
||||
else if(meta == 1)
|
||||
renderSkull(x,y,z, r, sidePlacement, modelEnderManJaw, textures[0]);
|
||||
}
|
||||
|
||||
public void renderSkull(float x, float y, float z, float r, int sidePlacement, ModelBase model, ResourceLocation texture)
|
||||
{
|
||||
// chose texture
|
||||
this.bindTexture(textures[meta]);
|
||||
this.bindTexture(texture);
|
||||
|
||||
// debug
|
||||
//model = new ModelSkeletonHead(0,16,64,32);
|
||||
@@ -115,10 +125,9 @@ public class IguanaTileEntitySkullRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
model.render(null, 0.0f, 0.0f, 0.0f, r, 0.0f, f4);
|
||||
|
||||
// also render endermanstuff!
|
||||
if(meta == 0)
|
||||
// also render enderman eyes!
|
||||
if(model == modelEnderManHead)
|
||||
{
|
||||
//modelEnderManJaw.render(null, 0.0f, 0.0f, 0.0f, r, 0.0f, f4);
|
||||
this.bindTexture(enderManEyes);
|
||||
model.render(null, 0.0f, 0.0f, 0.0f, r, 0.0f, f4);
|
||||
}
|
||||
|
||||
+13
-2
@@ -3,7 +3,10 @@ package iguanaman.iguanatweakstconstruct.mobheads.renderers;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import iguanaman.iguanatweakstconstruct.IguanaTweaksTConstruct;
|
||||
import iguanaman.iguanatweakstconstruct.claybuckets.IguanaItems;
|
||||
import iguanaman.iguanatweakstconstruct.mobheads.IguanaMobHeads;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -14,14 +17,22 @@ public class RenderPlayerHandler {
|
||||
public void renderSkullHelmet(RenderPlayerEvent.SetArmorModel event)
|
||||
{
|
||||
ItemStack itemStack = event.entityPlayer.inventory.armorItemInSlot(3);
|
||||
if(itemStack == null || itemStack.getItem() != IguanaMobHeads.skullItem)
|
||||
if(itemStack == null)
|
||||
return;
|
||||
|
||||
Item item = itemStack.getItem();
|
||||
boolean isBucket = IguanaTweaksTConstruct.isItemsActive && item == IguanaItems.wearableBuckets;
|
||||
if(item != IguanaMobHeads.skullItem && !isBucket)
|
||||
return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
event.renderer.modelBipedMain.bipedHead.postRender(0.0625F);
|
||||
float f1 = 1.0625F;
|
||||
GL11.glScalef(f1, -f1, -f1);
|
||||
IguanaTileEntitySkullRenderer.renderer.renderSkull(-0.5f, 0.0f, -0.5f, 180.0f, 1, itemStack.getItemDamage());
|
||||
if(isBucket)
|
||||
IguanaTileEntitySkullRenderer.renderer.renderBucket(-0.5f, 0.0f, -0.5f, 180.0f, 1, itemStack.getItemDamage());
|
||||
else
|
||||
IguanaTileEntitySkullRenderer.renderer.renderSkull(-0.5f, 0.0f, -0.5f, 180.0f, 1, itemStack.getItemDamage());
|
||||
//TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 00.0F, 0, null);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user