update textures #3 + item code cleanup
|
@ -128,7 +128,6 @@ import common.inventory.InventoryPlayer;
|
|||
import common.item.Item;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.log.Log;
|
||||
import common.log.LogLevel;
|
||||
import common.net.bootstrap.Bootstrap;
|
||||
|
|
|
@ -19,7 +19,7 @@ import common.init.BlockRegistry;
|
|||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
||||
import common.item.tool.ItemPotion;
|
||||
import common.item.consumable.ItemPotion;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Set;
|
|||
|
||||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.block.liquid.BlockDynamicLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.block.liquid.BlockStaticLiquid;
|
||||
|
@ -18,7 +19,10 @@ import common.collect.Sets;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.util.Facing;
|
||||
import common.util.Pair;
|
||||
import common.world.State;
|
||||
|
@ -64,13 +68,13 @@ public abstract class ModelBakery
|
|||
for (Item item : ItemRegistry.items())
|
||||
{
|
||||
String loc = "item/" + ItemRegistry.getName(item);
|
||||
models.put(loc, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getName(item)));
|
||||
models.put(loc, getModel(item, ModelBlock.PROVIDER, ItemRegistry.getName(item)));
|
||||
itemLocations.add(loc);
|
||||
String[] extra = item.getSprites();
|
||||
if(extra != null) {
|
||||
for(String sprite : extra) {
|
||||
loc = "item/" + sprite;
|
||||
models.put(loc, (ModelBlock)ModelBlock.PROVIDER.getModel(item.getTransform(), sprite));
|
||||
models.put(loc, new ModelBlock(Transform.IDENTITY, sprite));
|
||||
itemLocations.add(loc);
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +208,21 @@ public abstract class ModelBakery
|
|||
return bakedRegistry;
|
||||
}
|
||||
|
||||
private static final ModelBlock getModel(Item item, ModelProvider provider, String name) {
|
||||
ModelBlock model = (ModelBlock)item.getCustomModel(provider, name);
|
||||
if(model != null)
|
||||
return new ModelBlock(model, item.getCustomTransform());
|
||||
if(item.hasBuiltinModel())
|
||||
return new ModelBlock(MODEL_ENTITY, Transform.IDENTITY);
|
||||
Block block = item.getBlock();
|
||||
if(block != null && block.getRenderType() != 3)
|
||||
return new ModelBlock(MODEL_ENTITY, Transform.IDENTITY);
|
||||
State state = block == null ? null : block.getItemState();
|
||||
if(state != null)
|
||||
return state.getBlock().hasBlockFlatTexture() ? new ModelBlock(state.getBlock().getTransform(), "blocks/" + name) : new ModelBlock((ModelBlock)state.getBlock().getModel(provider, BlockRegistry.getName(state.getBlock()), state), state.getBlock().getTransform());
|
||||
return new ModelBlock(Transform.IDENTITY, item.getTextures(name));
|
||||
}
|
||||
|
||||
private static IBakedModel bakeModel(Map<String, TextureAtlasSprite> sprites, FaceBakery faceBakery,
|
||||
TextureAtlasSprite fallback, ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked)
|
||||
{
|
||||
|
|
|
@ -17,18 +17,6 @@ public class ModelBlock extends Model {
|
|||
public Model getModel(String primary) {
|
||||
return new ModelBlock(primary);
|
||||
}
|
||||
|
||||
public Model getModel(Transform transform, String... layers) {
|
||||
return new ModelBlock(transform, layers);
|
||||
}
|
||||
|
||||
public Model getModel(Model parent, Transform transform) {
|
||||
return new ModelBlock((ModelBlock)parent, transform);
|
||||
}
|
||||
|
||||
public Model getEntityModel() {
|
||||
return ModelBakery.MODEL_ENTITY;
|
||||
}
|
||||
};
|
||||
|
||||
private final List<BlockPart> elements;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package client.renderer.entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.renderer.Drawing;
|
||||
import client.renderer.Frustum;
|
||||
import client.renderer.GlState;
|
||||
import common.entity.Entity;
|
||||
import common.util.BoundingBox;
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ public class RenderItem
|
|||
|
||||
if (flag && bakedquad.hasTintIndex())
|
||||
{
|
||||
k = stack.getItem().getColorFromItemStack(stack, bakedquad.getTintIndex());
|
||||
k = stack.getItem().getRenderColor(stack, bakedquad.getTintIndex());
|
||||
k = k | -16777216;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import client.renderer.model.ModelArmor;
|
|||
import client.renderer.model.ModelBiped;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.item.material.ItemArmor;
|
||||
|
||||
public class LayerArmor implements LayerRenderer<EntityLiving>
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.Transform;
|
||||
|
||||
public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
||||
|
@ -55,7 +54,7 @@ public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
|||
Item item = itemstack.getItem();
|
||||
Client gm = Client.CLIENT;
|
||||
|
||||
if (item instanceof ItemBlock && item.getBlock().getRenderType() == 2)
|
||||
if (item.getBlock() != null && item.getBlock().getRenderType() == 2)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
|
||||
|
|
|
@ -7,14 +7,11 @@ import client.renderer.GlState;
|
|||
import client.renderer.layers.LayerArmor;
|
||||
import client.renderer.model.ModelHorse;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.block.tile.BlockSign;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemSign;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.item.tool.ItemHorseArmor;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.item.material.ItemHorseArmor;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.Facing;
|
||||
|
@ -53,13 +50,13 @@ public class TileEntityItemStackRenderer {
|
|||
private final ModelHorse horse = new ModelHorse();
|
||||
|
||||
public void renderByItem(ItemStack stack) {
|
||||
if(stack.getItem() != null && stack.getItem().getBlock() instanceof BlockChest chest) {
|
||||
if(stack.getItem().getBlock() instanceof BlockChest chest) {
|
||||
this.state = chest.getState().withProperty(BlockChest.FACING, Facing.SOUTH);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chest, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
this.state = null;
|
||||
}
|
||||
else if(stack.getItem() instanceof ItemSign sign) {
|
||||
this.state = sign.getBlock().getState().withProperty(BlockStandingSign.ROTATION, 8);
|
||||
else if(stack.getItem().getBlock() instanceof BlockStandingSign sign) {
|
||||
this.state = sign.getState().withProperty(BlockStandingSign.ROTATION, 8);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.sign, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
this.state = null;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.lwjgl.opengl.GL11;
|
|||
import client.renderer.Drawing;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.model.ModelSign;
|
||||
import common.block.Block;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.init.Blocks;
|
||||
|
|
|
@ -14,7 +14,6 @@ import common.init.EntityRegistry;
|
|||
import common.init.UniverseRegistry;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketBreak;
|
||||
import common.packet.CPacketClick;
|
||||
|
@ -233,13 +232,8 @@ public class PlayerController {
|
|||
flag = true;
|
||||
}
|
||||
|
||||
if(!flag && stack != null && stack.getItem() instanceof ItemBlock) {
|
||||
ItemBlock itemblock = (ItemBlock)stack.getItem();
|
||||
|
||||
if(!itemblock.canPlaceBlockOnSide(world, pos, side, player, stack)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(!flag && stack != null && stack.getItem().getBlock() != null && !stack.getItem().getBlock().canPlace(world, pos, side, player, stack))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
stack.getItem().onItemUse(stack, player, world, pos, side, f, f1, f2);
|
||||
|
|
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 422 B |
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 100 B After Width: | Height: | Size: 100 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 379 B |
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 562 B After Width: | Height: | Size: 562 B |
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 621 B |
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 283 B |
BIN
client/src/main/resources/textures/items/wheat_seed.png
Executable file
After Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 283 B |