mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-11-28 16:06:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
061acb5e9b | ||
|
|
cb119dde15 | ||
|
|
4927757ee6 |
No files matched your search
+2
-2
@@ -3,7 +3,7 @@
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:Baubles-Expanded:2.2.25-GTNH:dev')
|
||||
api('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive=false}
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-NH:1.0.2:api')
|
||||
api('com.github.GTNewHorizons:ThaumicBoots:1.5.13:dev') {transitive=false}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Botania:1.13.39-GTNH:dev') {transitive=false}
|
||||
@@ -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:1.7.18:dev') {transitive=false}
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:2.0.0: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,7 +42,6 @@ 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;
|
||||
@@ -62,7 +61,6 @@ 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;
|
||||
@@ -159,9 +157,6 @@ 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(
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
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) {}
|
||||
}
|
||||
@@ -131,6 +131,18 @@ 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,20 +6,22 @@
|
||||
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.IPartFactory;
|
||||
import codechicken.multipart.MultiPartRegistry.IPartFactory2;
|
||||
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 IPartFactory, IPartConverter {
|
||||
public class RegisterBlockPart implements IPartFactory2, IPartConverter {
|
||||
|
||||
Block block = null;
|
||||
Class<? extends TMultiPart> part = null;
|
||||
@@ -41,7 +43,22 @@ public class RegisterBlockPart implements IPartFactory, IPartConverter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart createPart(String name, boolean client) {
|
||||
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) {
|
||||
if (name.equals(name)) try {
|
||||
return part.getConstructor().newInstance();
|
||||
} catch (Exception e) {
|
||||
@@ -55,7 +72,7 @@ public class RegisterBlockPart implements IPartFactory, IPartConverter {
|
||||
public void init() {
|
||||
if (name.isEmpty() || block == null || part == null) return;
|
||||
MultiPartRegistry.registerConverter(this);
|
||||
MultiPartRegistry.registerParts(this, new String[] { name });
|
||||
MultiPartRegistry.registerPartFactory(this, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user