mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f373d5d94c | ||
|
|
1e816da486 | ||
|
|
68fa109b00 | ||
|
|
2b98cfa14b | ||
|
|
fa0ce8fd57 |
No files matched your search
+1
-1
@@ -12,7 +12,7 @@ dependencies {
|
||||
compileOnly('com.github.GTNewHorizons:EnderStorage:1.8.9:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.19.34:api') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:TinkersConstruct:1.14.120-GTNH:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:2.0.0:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.18:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:CodeChickenCore:1.4.22:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.64-GTNH:api') {transitive=false}
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:api') {transitive=false}
|
||||
|
||||
@@ -42,6 +42,7 @@ import thaumic.tinkerer.client.render.block.RenderInfusedCrops;
|
||||
import thaumic.tinkerer.client.render.block.RenderMagnet;
|
||||
import thaumic.tinkerer.client.render.block.RenderRepairer;
|
||||
import thaumic.tinkerer.client.render.block.kami.RenderWarpGate;
|
||||
import thaumic.tinkerer.client.render.item.RenderGenericSeeds;
|
||||
import thaumic.tinkerer.client.render.item.RenderMobDisplay;
|
||||
import thaumic.tinkerer.client.render.item.kami.RenderPlacementMirror;
|
||||
import thaumic.tinkerer.client.render.tile.RenderTileAnimationTablet;
|
||||
@@ -61,6 +62,7 @@ import thaumic.tinkerer.common.compat.FumeTool;
|
||||
import thaumic.tinkerer.common.compat.LoadedMods;
|
||||
import thaumic.tinkerer.common.core.handler.ConfigHandler;
|
||||
import thaumic.tinkerer.common.core.proxy.TTCommonProxy;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
import thaumic.tinkerer.common.item.ItemMobDisplay;
|
||||
import thaumic.tinkerer.common.item.kami.ItemPlacementMirror;
|
||||
import thaumic.tinkerer.common.item.kami.foci.ItemFocusShadowbeam;
|
||||
@@ -157,6 +159,9 @@ public final class TTClientProxy extends TTCommonProxy {
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
ThaumicTinkerer.registry.getFirstItemFromClass(ItemMobDisplay.class),
|
||||
mobDisplayRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
ThaumicTinkerer.registry.getFirstItemFromClass(ItemInfusedSeeds.class),
|
||||
new RenderGenericSeeds());
|
||||
|
||||
if (ConfigHandler.enableKami) {
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package thaumic.tinkerer.client.render.item;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumic.tinkerer.common.item.ItemInfusedSeeds;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 8/6/14.
|
||||
*/
|
||||
public class RenderGenericSeeds implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if (type == ItemRenderType.INVENTORY) return true;
|
||||
if (type == ItemRenderType.EQUIPPED) return true;
|
||||
if (type == ItemRenderType.ENTITY) return true;
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
if (helper == ItemRendererHelper.ENTITY_BOBBING) return true;
|
||||
if (helper == ItemRendererHelper.ENTITY_ROTATION) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack itemstack, Object... data) {
|
||||
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
ItemInfusedSeeds item = (ItemInfusedSeeds) itemstack.getItem();
|
||||
IIcon icon = item.getIconIndex(itemstack);
|
||||
Aspect aspect = item.getAspect(itemstack);
|
||||
if (type == ItemRenderType.INVENTORY) {
|
||||
renderItemInInventory(itemstack, aspect, icon);
|
||||
} else if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
renderItemInEquipped(itemstack, aspect, icon);
|
||||
} else {
|
||||
EntityItem entityItem = (EntityItem) data[1];
|
||||
if (entityItem.worldObj == null) {
|
||||
float angle = (Minecraft.getSystemTime() % 8000L) / 8000.0F * 360.0F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(-0.2F, -0.5F, 0.0F);
|
||||
renderItemAsEntity(itemstack, aspect, icon);
|
||||
GL11.glPopMatrix();
|
||||
} else {
|
||||
renderItemAsEntity(itemstack, aspect, icon);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private void renderItemInInventory(ItemStack itemstack, Aspect aspect, IIcon icon) {
|
||||
setColorForAspect(aspect);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
drawTexturedRectUV(0, 0, 0, 16, 16, icon);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private void renderItemInEquipped(ItemStack itemstack, Aspect aspect, IIcon icon) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
setColorForAspect(aspect);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tessellator,
|
||||
icon.getMaxU(),
|
||||
icon.getMinV(),
|
||||
icon.getMinU(),
|
||||
icon.getMaxV(),
|
||||
icon.getIconWidth(),
|
||||
icon.getIconHeight(),
|
||||
0.0625F);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
private void renderItemAsEntity(ItemStack itemstack, Aspect aspect, IIcon icon) {
|
||||
GL11.glPushMatrix();
|
||||
setColorForAspect(aspect);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
drawTextureIn3D(icon);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void drawTextureIn3D(IIcon texture) {
|
||||
Tessellator tesselator = Tessellator.instance;
|
||||
float scale = 0.7F;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tesselator,
|
||||
texture.getMaxU(),
|
||||
texture.getMinV(),
|
||||
texture.getMinU(),
|
||||
texture.getMaxV(),
|
||||
texture.getIconWidth(),
|
||||
texture.getIconHeight(),
|
||||
.05F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void drawTexturedRectUV(float x, float y, float z, int w, int h, IIcon icon) {
|
||||
Tessellator tesselator = Tessellator.instance;
|
||||
tesselator.startDrawingQuads();
|
||||
tesselator.addVertexWithUV(x, y + h, z, icon.getMinU(), icon.getMaxV());
|
||||
tesselator.addVertexWithUV(x + w, y + h, z, icon.getMaxU(), icon.getMaxV());
|
||||
tesselator.addVertexWithUV(x + w, y, z, icon.getMaxU(), icon.getMinV());
|
||||
tesselator.addVertexWithUV(x, y, z, icon.getMinU(), icon.getMinV());
|
||||
tesselator.draw();
|
||||
}
|
||||
|
||||
private void setColorForAspect(Aspect aspect) {}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Created by pixlepix on 3/31/14.
|
||||
* <p/>
|
||||
@@ -97,7 +99,7 @@ public enum EnumOreFrequency {
|
||||
for (EnumOreFrequency e : getValidOres()) {
|
||||
randInt -= e.freq;
|
||||
if (randInt < 0) {
|
||||
return OreDictionary.getOres(e.name).get(0);
|
||||
return e.getOre();
|
||||
}
|
||||
}
|
||||
return new ItemStack(Blocks.iron_ore);
|
||||
@@ -105,6 +107,17 @@ public enum EnumOreFrequency {
|
||||
|
||||
public boolean isValid() {
|
||||
return !Arrays.asList(OreClusterGenerator.blacklist).contains(name) && !OreDictionary.getOres(name).isEmpty()
|
||||
&& OreDictionary.getOres(name).get(0).getItem() instanceof ItemBlock;
|
||||
&& getOre().getItem() instanceof ItemBlock;
|
||||
}
|
||||
|
||||
/// The ore block generated for this name: MaterialLib's when it registers one, since other mods' ore blocks
|
||||
/// under the same name are copies of it, else the first block registered.
|
||||
private ItemStack getOre() {
|
||||
ArrayList<ItemStack> ores = OreDictionary.getOres(name);
|
||||
for (ItemStack ore : ores) {
|
||||
GameRegistry.UniqueIdentifier id = GameRegistry.findUniqueIdentifierFor(ore.getItem());
|
||||
if (id != null && "materiallib".equals(id.modId) && ore.getItem() instanceof ItemBlock) return ore;
|
||||
}
|
||||
return ores.get(0);
|
||||
}
|
||||
}
|
||||
@@ -131,18 +131,6 @@ public class ItemInfusedSeeds extends ItemSeeds implements ITTinkererItem {
|
||||
icons[6] = IconHelper.forName(par1IconRegister, "seed_generic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass) {
|
||||
Aspect aspect = getAspect(stack);
|
||||
if (aspect == null || aspect.isPrimal()) return 0xFFFFFF;
|
||||
return aspect.getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
return getIconIndex(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack stack) {
|
||||
return getAspect(stack) == null ? icons[0]
|
||||
|
||||
@@ -6,22 +6,20 @@
|
||||
package thaumic.tinkerer.common.multipart;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartConverter;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory2;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
// This class is used by FMP to recreate a part during loading and to convert already existing non-mutlipart blocks into
|
||||
// multiparts.
|
||||
// this is copied from the version FMP uses for vanilla torches
|
||||
public class RegisterBlockPart implements IPartFactory2, IPartConverter {
|
||||
public class RegisterBlockPart implements IPartFactory, IPartConverter {
|
||||
|
||||
Block block = null;
|
||||
Class<? extends TMultiPart> part = null;
|
||||
@@ -43,22 +41,7 @@ public class RegisterBlockPart implements IPartFactory2, IPartConverter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, NBTTagCompound nbt) {
|
||||
return newPart(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, MCDataInput packet) {
|
||||
return newPart(name);
|
||||
}
|
||||
|
||||
// Matches the legacy IPartFactory adapter, which answered previews with the client part.
|
||||
@Override
|
||||
public TMultiPart createPartForClientPreview(String name, NBTTagCompound nbt) {
|
||||
return newPart(name);
|
||||
}
|
||||
|
||||
private TMultiPart newPart(String name) {
|
||||
public TMultiPart createPart(String name, boolean client) {
|
||||
if (name.equals(name)) try {
|
||||
return part.getConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
@@ -72,7 +55,7 @@ public class RegisterBlockPart implements IPartFactory2, IPartConverter {
|
||||
public void init() {
|
||||
if (name.isEmpty() || block == null || part == null) return;
|
||||
MultiPartRegistry.registerConverter(this);
|
||||
MultiPartRegistry.registerPartFactory(this, name);
|
||||
MultiPartRegistry.registerParts(this, new String[] { name });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -116,6 +116,14 @@ public class TTRegistry {
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorSword());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.kami.tool.ItemIchorSwordAdv());
|
||||
loadSimpleItem(new thaumic.tinkerer.common.item.quartz.ItemDarkQuartz());
|
||||
|
||||
for (Item[] itemArrayList : itemRegistry.values()) {
|
||||
for (Item item : itemArrayList) {
|
||||
if (!(item instanceof ItemBlock)) {
|
||||
GameRegistry.registerItem(item, ((ITTinkererItem) item).getItemName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
@@ -123,13 +131,9 @@ public class TTRegistry {
|
||||
for (Item item : itemArrayList) {
|
||||
registerRecipe((ITTinkererRegisterable) item);
|
||||
|
||||
if (!(item instanceof ItemBlock)) {
|
||||
GameRegistry.registerItem(item, ((ITTinkererItem) item).getItemName());
|
||||
|
||||
if (((ITTinkererItem) item).shouldDisplayInTab()
|
||||
&& FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
ModCreativeTab.INSTANCE.addItem(item);
|
||||
}
|
||||
if (!(item instanceof ItemBlock) && ((ITTinkererItem) item).shouldDisplayInTab()
|
||||
&& FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
ModCreativeTab.INSTANCE.addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,15 +198,13 @@ public class TTRegistry {
|
||||
blockRegistry.put(newBlock.getClass(), blockList);
|
||||
blockList[0] = newBlock;
|
||||
|
||||
// Fill list before registering, ItemBlock constructors read it
|
||||
int index = 1;
|
||||
for (Block metaBlock : metaBlocks) {
|
||||
metaBlock.setBlockName(((ITTinkererBlock) metaBlock).getBlockName());
|
||||
blockList[index++] = metaBlock;
|
||||
}
|
||||
registerBlock(newBlock, ittBlock);
|
||||
for (Block metaBlock : metaBlocks) {
|
||||
registerBlock(metaBlock, (ITTinkererBlock) metaBlock);
|
||||
ITTinkererBlock metaIttBlock = (ITTinkererBlock) metaBlock;
|
||||
metaBlock.setBlockName(metaIttBlock.getBlockName());
|
||||
blockList[index++] = metaBlock;
|
||||
registerBlock(metaBlock, metaIttBlock);
|
||||
}
|
||||
|
||||
Class<? extends ItemBlock> itemBlock = ittBlock.getItemBlock();
|
||||
|
||||
Reference in new issue
Block a user