mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-20 12:19:39 +00:00
It bops the ore with the pick or it gets the hose again.
This commit is contained in:
1 parent
a27b6578df
commit
2ce89feeab
4 files changed
+103
-46
No files matched your search
@@ -2,6 +2,7 @@ package fox.spiteful.avaritia;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import fox.spiteful.avaritia.items.ItemArmorInfinity;
|
||||
import fox.spiteful.avaritia.items.ItemFracturedOre;
|
||||
import fox.spiteful.avaritia.items.LudicrousItems;
|
||||
import fox.spiteful.avaritia.items.tools.ItemPickaxeInfinity;
|
||||
import fox.spiteful.avaritia.items.tools.ItemSwordInfinity;
|
||||
@@ -32,6 +33,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
@@ -70,40 +72,8 @@ public class LudicrousEvents {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public void extraLuck(HarvestDropsEvent event){
|
||||
if(event.harvester == null)
|
||||
return;
|
||||
if(event.harvester.getHeldItem() == null)
|
||||
return;
|
||||
ItemStack held = event.harvester.getHeldItem();
|
||||
if(held.getItem() == LudicrousItems.infinity_pickaxe){
|
||||
if(event.block.getMaterial() == Material.rock){
|
||||
ArrayList<ItemStack> adds = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> removals = new ArrayList<ItemStack>();
|
||||
for(ItemStack drop : event.drops){
|
||||
if(drop.getItem() != Item.getItemFromBlock(event.block) && !(drop.getItem() instanceof ItemBlock)){
|
||||
drop.stackSize = Math.min(drop.stackSize * 4, drop.getMaxStackSize());
|
||||
}
|
||||
else if(drop.getItem() == Item.getItemFromBlock(event.block) && FurnaceRecipes.smelting().getSmeltingResult(drop) != null
|
||||
&& drop.getItem() != Item.getItemFromBlock(Blocks.netherrack)
|
||||
&& !(FurnaceRecipes.smelting().getSmeltingResult(drop).getItem() instanceof ItemBlock)){
|
||||
ItemStack smelt = FurnaceRecipes.smelting().getSmeltingResult(drop).copy();
|
||||
smelt.stackSize = Math.min(drop.stackSize * 10, drop.getMaxStackSize());
|
||||
adds.add(smelt);
|
||||
removals.add(drop);
|
||||
}
|
||||
}
|
||||
for(ItemStack add : adds)
|
||||
event.drops.add(add);
|
||||
for(ItemStack rem : removals)
|
||||
event.drops.remove(rem);
|
||||
event.dropChance = 1.0F;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@SubscribeEvent
|
||||
public void extraLuck(HarvestDropsEvent event){
|
||||
if(event.harvester == null)
|
||||
return;
|
||||
@@ -112,22 +82,26 @@ public class LudicrousEvents {
|
||||
ItemStack held = event.harvester.getHeldItem();
|
||||
if(held.getItem() == LudicrousItems.infinity_pickaxe){
|
||||
if(event.block.getMaterial() == Material.rock){
|
||||
List<ItemStack> adds = new ArrayList<ItemStack>();
|
||||
for(ItemStack drop : event.drops){
|
||||
if(drop.getItem() != Item.getItemFromBlock(event.block) && !(drop.getItem() instanceof ItemBlock)){
|
||||
drop.stackSize = Math.min(drop.stackSize * 4, drop.getMaxStackSize());
|
||||
}
|
||||
else if(drop.getItem() == Item.getItemFromBlock(event.block))
|
||||
{
|
||||
ItemFracturedOre ifo = (ItemFracturedOre)LudicrousItems.fractured_ore;
|
||||
int[] oreids = OreDictionary.getOreIDs(drop);
|
||||
for (int i=0; i<oreids.length; i++) {
|
||||
String orename = OreDictionary.getOreName(oreids[i]);
|
||||
if (orename.startsWith("ore")) {
|
||||
// add the fractured ores
|
||||
adds.add(ifo.getStackForOre(drop, Math.min(drop.stackSize * 4, drop.getMaxStackSize())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
event.drops.addAll(adds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -30,6 +32,7 @@ public class ItemFracturedOre extends Item {
|
||||
public static final String OREKEY = "ore";
|
||||
protected static List<ItemStack> emulatedOres = new ArrayList<ItemStack>();
|
||||
protected static Map<String, ItemStack> nameMapping = new HashMap<String, ItemStack>();
|
||||
public static IIcon unknownIcon;
|
||||
|
||||
public ItemFracturedOre() {
|
||||
this.setCreativeTab(Avaritia.tab);
|
||||
@@ -43,13 +46,13 @@ public class ItemFracturedOre extends Item {
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
for (ItemStack stack : emulatedOres) {
|
||||
// for debug purposes only - don't want these cluttering up the tab.
|
||||
/*for (ItemStack stack : emulatedOres) {
|
||||
list.add(getStackForOre(stack, 1));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public ItemStack getStackForOre(ItemStack orestack, int stacksize) {
|
||||
//NBTTagCompound oretag = orestack.writeToNBT(new NBTTagCompound());
|
||||
NBTTagCompound oretag = NameStack.saveStackToNBT(orestack);
|
||||
|
||||
ItemStack outstack = new ItemStack(this, stacksize, 0);
|
||||
@@ -84,6 +87,14 @@ public class ItemFracturedOre extends Item {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister ir) {
|
||||
super.registerIcons(ir);
|
||||
|
||||
this.unknownIcon = ir.registerIcon("avaritia:unknown");
|
||||
}
|
||||
|
||||
// ########################################
|
||||
|
||||
public static void brushUpUncomfortablyAgainstTheOreDictionary() {
|
||||
@@ -117,7 +128,6 @@ public class ItemFracturedOre extends Item {
|
||||
for (String name : toRegister.keySet()) {
|
||||
Collection<ItemStack> stacks = toRegister.get(name);
|
||||
for (ItemStack stack : stacks) {
|
||||
//ItemStack orestack = ItemStack.loadItemStackFromNBT(stack.getTagCompound().getCompoundTag(OREKEY));
|
||||
ItemStack orestack = NameStack.loadFromNBT(stack.getTagCompound().getCompoundTag(OREKEY)).getStack();
|
||||
int[] oreids = OreDictionary.getOreIDs(orestack);
|
||||
for (int i=0; i<oreids.length; i++) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import fox.spiteful.avaritia.items.ItemFracturedOre;
|
||||
import fox.spiteful.avaritia.items.ItemFracturedOre.NameStack;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -65,6 +66,8 @@ public class FracturedOreRenderer implements IItemRenderer {
|
||||
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
boolean unknown = false;
|
||||
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey(ItemFracturedOre.OREKEY)) {
|
||||
ItemStack orestack = NameStack.loadFromNBT(item.getTagCompound().getCompoundTag(ItemFracturedOre.OREKEY)).getStack();
|
||||
|
||||
@@ -72,7 +75,7 @@ public class FracturedOreRenderer implements IItemRenderer {
|
||||
|
||||
Item oreitem = orestack.getItem();
|
||||
if (oreitem instanceof ItemBlock) {
|
||||
ItemBlock ib = (ItemBlock)oreitem;
|
||||
/*ItemBlock ib = (ItemBlock)oreitem;
|
||||
Block b = ib.field_150939_a;
|
||||
IIcon oreicon = b.getIcon(0, orestack.getItemDamage());
|
||||
|
||||
@@ -91,13 +94,41 @@ public class FracturedOreRenderer implements IItemRenderer {
|
||||
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
t.draw();
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);*/
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
RenderItem ri = RenderItem.getInstance();
|
||||
|
||||
GL11.glTranslated(33.125, 10, 32);
|
||||
GL11.glScaled(16, 16, 16);
|
||||
GL11.glRotatef(-90.0F, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glRotatef(45.0F, 0.0F, -1.0F, 0.0F);
|
||||
GL11.glRotatef(210.0F, -1.0F, 0.0F, 0.0F);
|
||||
GL11.glScalef(1.0F, 1.0F, -1.0F);
|
||||
GL11.glTranslatef(-1.0F, -0.5F, -1.0F);
|
||||
GL11.glScalef(0.1F, 0.1F, 0.1F);
|
||||
GL11.glRotated(180, 1, 0, 0);
|
||||
|
||||
GL11.glTranslated(2, -3, 3);
|
||||
|
||||
|
||||
GL11.glDepthFunc(GL11.GL_GEQUAL);
|
||||
ri.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), orestack, 0, 0);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
} else {
|
||||
unknown = true;
|
||||
}
|
||||
} else {
|
||||
unknown = true;
|
||||
}
|
||||
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
@@ -133,12 +164,31 @@ public class FracturedOreRenderer implements IItemRenderer {
|
||||
|
||||
t.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
if (unknown) {
|
||||
IIcon uicon = ItemFracturedOre.unknownIcon;
|
||||
|
||||
minu = uicon.getMinU();
|
||||
maxu = uicon.getMaxU();
|
||||
minv = uicon.getMinV();
|
||||
maxv = uicon.getMaxV();
|
||||
|
||||
t.startDrawingQuads();
|
||||
t.addVertexWithUV(0, 0, 0, minu, minv);
|
||||
t.addVertexWithUV(0, 16, 0, minu, maxv);
|
||||
t.addVertexWithUV(16, 16, 0, maxu, maxv);
|
||||
t.addVertexWithUV(16, 0, 0, maxu, minv);
|
||||
|
||||
t.draw();
|
||||
}
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
r.renderWithColor = true;
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
}
|
||||
@@ -167,15 +217,22 @@ public class FracturedOreRenderer implements IItemRenderer {
|
||||
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), scale);
|
||||
|
||||
boolean unknown = false;
|
||||
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey(ItemFracturedOre.OREKEY)) {
|
||||
ItemStack orestack = NameStack.loadFromNBT(item.getTagCompound().getCompoundTag(ItemFracturedOre.OREKEY)).getStack();
|
||||
|
||||
mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
Item oreitem = orestack.getItem();
|
||||
if (oreitem instanceof ItemBlock) {
|
||||
if (oreitem instanceof ItemBlock) {
|
||||
ItemBlock ib = (ItemBlock)oreitem;
|
||||
Block b = ib.field_150939_a;
|
||||
|
||||
if (b instanceof ITileEntityProvider) {
|
||||
unknown = true;
|
||||
}
|
||||
|
||||
IIcon oreicon = b.getIcon(0, orestack.getItemDamage());
|
||||
//IIcon oreicon = item.getIconIndex();
|
||||
|
||||
@@ -191,6 +248,8 @@ public class FracturedOreRenderer implements IItemRenderer {
|
||||
|
||||
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
} else {
|
||||
unknown = true;
|
||||
}
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -215,16 +274,30 @@ public class FracturedOreRenderer implements IItemRenderer {
|
||||
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, maxu, minv, minu, maxv, icon.getIconWidth(), icon.getIconHeight(), scale);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
if (!CosmicRenderShenanigans.inventoryRender) {
|
||||
mc.entityRenderer.enableLightmap(0.0);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
if (unknown) {
|
||||
IIcon uicon = ItemFracturedOre.unknownIcon;
|
||||
|
||||
minu = uicon.getMinU();
|
||||
maxu = uicon.getMaxU();
|
||||
minv = uicon.getMinV();
|
||||
maxv = uicon.getMaxV();
|
||||
|
||||
ItemRenderer.renderItemIn2D(Tessellator.instance, maxu, minv, minu, maxv, uicon.getIconWidth(), uicon.getIconHeight(), scale);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
if (!CosmicRenderShenanigans.inventoryRender) {
|
||||
mc.entityRenderer.enableLightmap(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user