improve wielding concept
This commit is contained in:
parent
3a9ec2ab32
commit
c396475ebd
95 changed files with 521 additions and 527 deletions
|
@ -21,7 +21,7 @@ import common.item.Item;
|
|||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Vec3;
|
||||
|
@ -99,34 +99,32 @@ public class ItemRenderer
|
|||
this.itemRenderer = gmIn.getRenderItem();
|
||||
}
|
||||
|
||||
public void renderItem(EntityLiving entityIn, ItemStack heldStack, Transforms.Camera transform)
|
||||
public void renderItem(EntityLiving entityIn, ItemStack heldStack, boolean third)
|
||||
{
|
||||
if (heldStack != null)
|
||||
{
|
||||
Item item = heldStack.getItem();
|
||||
if(item.isFirstPerson() || transform != Transforms.Camera.FIRST_PERSON) {
|
||||
Block block = item.getBlock();
|
||||
GL11.glPushMatrix();
|
||||
Block block = item.getBlock();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (this.itemRenderer.shouldRenderItemIn3D(heldStack))
|
||||
{
|
||||
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
if (this.itemRenderer.shouldRenderItemIn3D(heldStack))
|
||||
{
|
||||
GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
|
||||
if (this.isBlockTranslucent(block))
|
||||
{
|
||||
GlState.depthMask(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.itemRenderer.renderItemModelForEntity(heldStack, entityIn, transform);
|
||||
|
||||
if (this.isBlockTranslucent(block))
|
||||
{
|
||||
GlState.depthMask(true);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
if (this.isBlockTranslucent(block))
|
||||
{
|
||||
GlState.depthMask(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.itemRenderer.renderItemForEntity(heldStack, entityIn, third);
|
||||
|
||||
if (this.isBlockTranslucent(block))
|
||||
{
|
||||
GlState.depthMask(true);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,7 +360,7 @@ public class ItemRenderer
|
|||
GlState.enableRescaleNormal();
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (this.itemToRender != null)
|
||||
if (this.itemToRender != null && (this.itemToRender.getItem().getWieldType() != null || (clientplayer.getItemInUseCount() > 0 && this.itemToRender.getItemUseAction() != ItemAction.NONE)))
|
||||
{
|
||||
if (clientplayer.getItemInUseCount() > 0)
|
||||
{
|
||||
|
@ -396,9 +394,9 @@ public class ItemRenderer
|
|||
this.transformFirstPersonItem(f, f1);
|
||||
}
|
||||
|
||||
this.renderItem(clientplayer, this.itemToRender, Transforms.Camera.FIRST_PERSON);
|
||||
this.renderItem(clientplayer, this.itemToRender, false);
|
||||
}
|
||||
else
|
||||
else if(this.itemToRender == null || this.itemToRender.getItem().canRenderHand())
|
||||
{
|
||||
this.renderPlayerArm(clientplayer, f, f1);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ import java.util.List;
|
|||
|
||||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import common.collect.Lists;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.Facing;
|
||||
|
||||
public record BakedModel(List<BakedQuad> getQuads, List<List<BakedQuad>> getFace, boolean isGui3d, TextureAtlasSprite getBaseTexture, Transforms getTransforms) implements IBakedModel {
|
||||
public record BakedModel(List<BakedQuad> getQuads, List<List<BakedQuad>> getFace, boolean isGui3d, TextureAtlasSprite getBaseTexture, Transform getTransforms) implements IBakedModel {
|
||||
public List<BakedQuad> getFace(Facing face) {
|
||||
return this.getFace.get(face.ordinal());
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public record BakedModel(List<BakedQuad> getQuads, List<List<BakedQuad>> getFace
|
|||
private final List<List<BakedQuad>> faces;
|
||||
private TextureAtlasSprite texture;
|
||||
private boolean gui3d;
|
||||
private Transforms transforms;
|
||||
private Transform transforms;
|
||||
|
||||
public Builder(ModelBlock model) {
|
||||
this(model.isGui3d(), model.getTransform());
|
||||
|
@ -51,7 +51,7 @@ public record BakedModel(List<BakedQuad> getQuads, List<List<BakedQuad>> getFace
|
|||
}
|
||||
}
|
||||
|
||||
private Builder(boolean gui3d, Transforms transforms) {
|
||||
private Builder(boolean gui3d, Transform transforms) {
|
||||
this.quads = Lists.<BakedQuad>newArrayList();
|
||||
this.faces = new ArrayList<List<BakedQuad>>(6);
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ package client.renderer.blockmodel;
|
|||
import java.util.List;
|
||||
|
||||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.Facing;
|
||||
|
||||
public record BuiltInModel(Transforms getTransforms) implements IBakedModel {
|
||||
public record BuiltInModel(Transform getTransforms) implements IBakedModel {
|
||||
public List<BakedQuad> getFace(Facing face) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package client.renderer.blockmodel;
|
|||
import java.util.List;
|
||||
|
||||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.Facing;
|
||||
|
||||
public interface IBakedModel
|
||||
|
@ -18,5 +18,5 @@ public interface IBakedModel
|
|||
|
||||
TextureAtlasSprite getBaseTexture();
|
||||
|
||||
Transforms getTransforms();
|
||||
Transform getTransforms();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.collect.Maps;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.Facing;
|
||||
import common.util.Vector3f;
|
||||
|
||||
|
@ -18,11 +18,11 @@ public class ModelBlock extends Model {
|
|||
return new ModelBlock(primary);
|
||||
}
|
||||
|
||||
public Model getModel(Transforms transform, String... layers) {
|
||||
public Model getModel(Transform transform, String... layers) {
|
||||
return new ModelBlock(transform, layers);
|
||||
}
|
||||
|
||||
public Model getModel(Model parent, Transforms transform) {
|
||||
public Model getModel(Model parent, Transform transform) {
|
||||
return new ModelBlock((ModelBlock)parent, transform);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class ModelBlock extends Model {
|
|||
|
||||
private ModelRotation rotation;
|
||||
private boolean uvLock;
|
||||
private Transforms transform;
|
||||
private Transform transform;
|
||||
|
||||
private BlockPart lastPart;
|
||||
private BlockPartFace[] last;
|
||||
|
@ -118,29 +118,29 @@ public class ModelBlock extends Model {
|
|||
|
||||
|
||||
public ModelBlock(String primary) {
|
||||
this(null, Lists.newArrayList(), primary != null && primary.indexOf('/') == -1 ? "blocks/" + primary : primary, true, true, Transforms.DEFAULT, null);
|
||||
this(null, Lists.newArrayList(), primary != null && primary.indexOf('/') == -1 ? "blocks/" + primary : primary, true, true, Transform.IDENTITY, null);
|
||||
}
|
||||
|
||||
public ModelBlock(Transforms transform, String ... layers) {
|
||||
public ModelBlock(Transform transform, String ... layers) {
|
||||
this(ModelBakery.MODEL_GENERATED, ModelBakery.MODEL_GENERATED.elements,
|
||||
layers[0].indexOf('/') == -1 ? "items/" + layers[0] : layers[0], false, false, transform, layers);
|
||||
}
|
||||
|
||||
public ModelBlock(ModelBlock parent, Transforms transform) {
|
||||
public ModelBlock(ModelBlock parent, Transform transform) {
|
||||
this(parent, Lists.newArrayList(), parent.getPrimary(), false, true, transform, null);
|
||||
}
|
||||
|
||||
public ModelBlock(String primary, Transforms transform, String ... layers) {
|
||||
public ModelBlock(String primary, Transform transform, String ... layers) {
|
||||
this(ModelBakery.MODEL_GENERATED, ModelBakery.MODEL_GENERATED.elements,
|
||||
primary.indexOf('/') == -1 ? "items/" + primary : primary, false, false, transform, layers);
|
||||
}
|
||||
|
||||
public ModelBlock(String primary, List<BlockPart> elements, Transforms transform, String ... layers) {
|
||||
public ModelBlock(String primary, List<BlockPart> elements, Transform transform, String ... layers) {
|
||||
this(null, elements, primary, false, false, transform, layers);
|
||||
}
|
||||
|
||||
private ModelBlock(ModelBlock parent, List<BlockPart> elements, String primary, boolean occlude, boolean gui3d,
|
||||
Transforms transform, String[] layers) {
|
||||
Transform transform, String[] layers) {
|
||||
for(int z = 0; layers != null && z < layers.length; z++) {
|
||||
layers[z] = layers[z].indexOf('/') == -1 ? "items/" + layers[z] : layers[z];
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ public class ModelBlock extends Model {
|
|||
return this.parent;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
public Transform getTransform() {
|
||||
return this.transform;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import client.Client;
|
|||
import client.renderer.model.ModelDie;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.entity.projectile.EntityDie;
|
||||
import common.model.Transforms.Camera;
|
||||
|
||||
public class RenderDie extends Render<EntityDie>
|
||||
{
|
||||
|
@ -33,7 +32,7 @@ public class RenderDie extends Render<EntityDie>
|
|||
GL11.glRotatef((float)((entity.ticksExisted % 10) * (360 / 10)), 0.3f, 0.4f, 0.1f);
|
||||
// GlState.translate(-0.05F, -0.05F, 0.05F);
|
||||
GL11.glScalef(0.5f, 0.5f, 0.5f);
|
||||
Client.CLIENT.getRenderItem().renderItem(entity.getStack(), Camera.GROUND);
|
||||
Client.CLIENT.getRenderItem().renderItemAsGround(entity.getStack());
|
||||
// blockrendererdispatcher.renderBlockBrightness(Blocks.planks.getDefaultState(), entity.getBrightness(partialTicks));
|
||||
GL11.glPopMatrix();
|
||||
super.doRender(entity, x, y, z, partialTicks);
|
||||
|
|
|
@ -8,7 +8,6 @@ import client.renderer.texture.TextureMap;
|
|||
import common.entity.item.EntityItem;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
|
||||
|
@ -40,8 +39,7 @@ public class RenderEntityItem extends Render<EntityItem>
|
|||
int i = this.getMultiplier(itemstack);
|
||||
float f = 0.25F;
|
||||
float f1 = ExtMath.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F;
|
||||
float f2 = p_177077_9_.getTransforms().get(Transforms.Camera.GROUND).scale();
|
||||
GL11.glTranslatef((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
|
||||
GL11.glTranslatef((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F, (float)p_177077_6_);
|
||||
|
||||
if (flag || this.manager.gm != null)
|
||||
{
|
||||
|
@ -126,18 +124,15 @@ public class RenderEntityItem extends Render<EntityItem>
|
|||
}
|
||||
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
RenderItem.apply(ibakedmodel.getTransforms(), Transforms.Camera.GROUND);
|
||||
this.itemRenderer.renderItem(itemstack, ibakedmodel);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
RenderItem.apply(ibakedmodel.getTransforms(), Transforms.Camera.GROUND);
|
||||
this.itemRenderer.renderItem(itemstack, ibakedmodel);
|
||||
GL11.glPopMatrix();
|
||||
float f3 = ibakedmodel.getTransforms().ground.scale();
|
||||
GL11.glTranslatef(0.0F, 0.0F, 0.046875F * f3);
|
||||
GL11.glTranslatef(0.0F, 0.0F, 0.046875F);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ public class RenderHumanoid extends RenderNpc
|
|||
modelplayer.raisedArms = npc.hasArmsRaised();
|
||||
// modelplayer.sticks = npc.hasPowerRods();
|
||||
|
||||
if (itemstack == null)
|
||||
if (itemstack == null || itemstack.getItem().getWieldType() == null)
|
||||
{
|
||||
modelplayer.heldItemRight = 0;
|
||||
}
|
||||
|
@ -210,6 +210,11 @@ public class RenderHumanoid extends RenderNpc
|
|||
this.setModelVisibilities(entity);
|
||||
modelplayer.swingProgress = 0.0F;
|
||||
modelplayer.isSneak = false;
|
||||
modelplayer.heldItemRight = 0;
|
||||
modelplayer.heldItemLeft = 0;
|
||||
modelplayer.aimedBow = false;
|
||||
modelplayer.isRiding = false;
|
||||
modelplayer.raisedArms = false;
|
||||
modelplayer.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, entity);
|
||||
modelplayer.renderRightArm((float)this.arms - 12.0f);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ import common.entity.npc.EntityNPC;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.model.Transforms;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3i;
|
||||
|
||||
|
@ -185,16 +185,16 @@ public class RenderItem
|
|||
}
|
||||
}
|
||||
|
||||
public void renderItem(ItemStack stack, Transforms.Camera cameraTransformType)
|
||||
public void renderItemAsGround(ItemStack stack)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
IBakedModel ibakedmodel = this.mesher.getItemModel(stack);
|
||||
this.renderItemModelTransform(stack, ibakedmodel, cameraTransformType);
|
||||
this.renderItemModelTransform(stack, ibakedmodel, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void renderItemModelForEntity(ItemStack stack, EntityLiving entityToRenderFor, Transforms.Camera cameraTransformType)
|
||||
public void renderItemForEntity(ItemStack stack, EntityLiving entityToRenderFor, boolean third)
|
||||
{
|
||||
if (stack != null && entityToRenderFor != null)
|
||||
{
|
||||
|
@ -209,11 +209,11 @@ public class RenderItem
|
|||
ibakedmodel = this.mesher.getModelManager().getModel("item/" + sprite);
|
||||
}
|
||||
|
||||
this.renderItemModelTransform(stack, ibakedmodel, cameraTransformType);
|
||||
this.renderItemModelTransform(stack, ibakedmodel, true, third);
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderItemModelTransform(ItemStack stack, IBakedModel model, Transforms.Camera cameraTransformType)
|
||||
protected void renderItemModelTransform(ItemStack stack, IBakedModel model, boolean transform, boolean third)
|
||||
{
|
||||
this.manager.bindTexture(TextureMap.BLOCKS);
|
||||
this.preTransform(stack);
|
||||
|
@ -222,9 +222,45 @@ public class RenderItem
|
|||
GlState.enableBlend();
|
||||
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||
GL11.glPushMatrix();
|
||||
Transforms itemcameratransforms = model.getTransforms();
|
||||
RenderItem.apply(itemcameratransforms, cameraTransformType);
|
||||
|
||||
if(transform) {
|
||||
WieldType type = stack.getItem().getWieldType();
|
||||
if(type == null)
|
||||
type = WieldType.DEFAULT;
|
||||
if(third) {
|
||||
switch(type) {
|
||||
case DEFAULT:
|
||||
GL11.glTranslatef(0.0f, 0.0625f, -3.0f * 0.0625f);
|
||||
GL11.glRotatef(-90.0f, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glScalef(0.55f, 0.55f, 0.55f);
|
||||
break;
|
||||
case TOOL_FLIP:
|
||||
GL11.glTranslatef(0.0f, 0.0f, -3.5f * 0.0625f);
|
||||
GL11.glRotatef(90.0f, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(180.0f, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-35.0f, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(0.85f, 0.85f, 0.85f);
|
||||
break;
|
||||
case TOOL:
|
||||
GL11.glTranslatef(0.0f, 1.25f * 0.0625f, -3.5f * 0.0625f);
|
||||
GL11.glRotatef(90.0f, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-35.0f, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(0.85f, 0.85f, 0.85f);
|
||||
break;
|
||||
case RANGED:
|
||||
GL11.glTranslatef(0.75f * 0.0625f, 0.0f, 0.25f * 0.0625f);
|
||||
GL11.glRotatef(80.0f, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(5.0f, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(-45.0f, 0.0F, 0.0F, 1.0F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
GL11.glTranslatef(0.0f, 4.0f * 0.0625f, 2.0f * 0.0625f);
|
||||
GL11.glRotatef(type == WieldType.TOOL_FLIP ? 45.0f : -135.0f, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(25.0f, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(1.7f, 1.7f, 1.7f);
|
||||
}
|
||||
}
|
||||
this.renderItem(stack, model);
|
||||
GlState.cullFace(GL11.GL_BACK);
|
||||
GL11.glPopMatrix();
|
||||
|
@ -245,8 +281,20 @@ public class RenderItem
|
|||
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setupGuiTransform(x, y, ibakedmodel.isGui3d());
|
||||
RenderItem.apply(ibakedmodel.getTransforms(), Transforms.Camera.GUI);
|
||||
Transform vec = ibakedmodel.getTransforms();
|
||||
if(vec != Transform.IDENTITY) {
|
||||
GL11.glTranslatef(vec.translationX(), vec.translationY(), vec.translationZ());
|
||||
GL11.glRotatef(vec.rotationY(), 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotationX(), 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotationZ(), 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(vec.scale(), vec.scale(), vec.scale());
|
||||
}
|
||||
boolean cull = GlState.isCullEnabled();
|
||||
if(!cull)
|
||||
GlState.enableCull();
|
||||
this.renderItem(stack, ibakedmodel);
|
||||
if(!cull)
|
||||
GlState.disableCull();
|
||||
GlState.disableAlpha();
|
||||
GlState.disableRescaleNormal();
|
||||
GlState.disableLighting();
|
||||
|
@ -292,15 +340,4 @@ public class RenderItem
|
|||
{
|
||||
this.mesher.rebuildCache();
|
||||
}
|
||||
|
||||
public static void apply(Transforms trans, Transforms.Camera type) {
|
||||
Transform vec = trans.get(type);
|
||||
if(vec != Transform.IDENTITY) {
|
||||
GL11.glTranslatef(vec.translationX(), vec.translationY(), vec.translationZ());
|
||||
GL11.glRotatef(vec.rotationY(), 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotationX(), 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(vec.rotationZ(), 0.0F, 0.0F, 1.0F);
|
||||
GL11.glScalef(vec.scale(), vec.scale(), vec.scale());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import client.renderer.texture.TextureMap;
|
|||
import common.entity.Entity;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
|
||||
|
||||
public class RenderItemEntity<T extends Entity> extends Render<T>
|
||||
|
@ -31,7 +31,7 @@ public class RenderItemEntity<T extends Entity> extends Render<T>
|
|||
GL11.glRotatef(-this.manager.playerViewY, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(this.manager.playerViewX, 1.0F, 0.0F, 0.0F);
|
||||
this.bindTexture(TextureMap.BLOCKS);
|
||||
this.itemRenderer.renderItem(this.getStack(entity), Transforms.Camera.GROUND);
|
||||
this.itemRenderer.renderItemAsGround(this.getStack(entity));
|
||||
GlState.disableRescaleNormal();
|
||||
GL11.glPopMatrix();
|
||||
super.doRender(entity, x, y, z, partialTicks);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class RenderSpaceMarine extends RenderNpc
|
|||
modelplayer.aimedBow = false;
|
||||
modelplayer.isSneak = false;
|
||||
|
||||
if (itemstack == null)
|
||||
if (itemstack == null || itemstack.getItem().getWieldType() == null)
|
||||
{
|
||||
modelplayer.heldItemRight = 0;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.init.Items;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
|
||||
public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
|||
{
|
||||
ItemStack itemstack = entitylivingbaseIn.getHeldItem();
|
||||
|
||||
if (itemstack != null)
|
||||
if (itemstack != null && itemstack.getItem().getWieldType() != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
|||
GL11.glTranslatef(0.0F, 0.203125F, 0.0F);
|
||||
}
|
||||
|
||||
gm.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, Transforms.Camera.THIRD_PERSON);
|
||||
gm.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, true);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 4.6 KiB |
BIN
client/src/main/resources/textures/items/plasma_bucket.png
Executable file
BIN
client/src/main/resources/textures/items/plasma_bucket.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
|
@ -35,7 +35,7 @@ import common.item.block.ItemBlock;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -174,7 +174,6 @@ public class Block {
|
|||
protected boolean shovelHarvest;
|
||||
protected boolean ticked;
|
||||
private boolean flatBlockTexture;
|
||||
private boolean flatItemTexture;
|
||||
private boolean itemColored;
|
||||
protected int lightOpacity;
|
||||
protected int lightValue;
|
||||
|
@ -369,12 +368,7 @@ public class Block {
|
|||
}
|
||||
|
||||
protected Block setFlatBlockTexture() {
|
||||
this.flatBlockTexture = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block setFlatItemTexture() {
|
||||
this.flatItemTexture = true;
|
||||
// this.flatBlockTexture = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -913,8 +907,8 @@ public class Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.BLOCK;
|
||||
public Transform getTransform() {
|
||||
return Transform.IDENTITY;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
@ -1055,10 +1049,6 @@ public class Block {
|
|||
return this.flatBlockTexture;
|
||||
}
|
||||
|
||||
public final boolean hasItemFlatTexture() {
|
||||
return this.flatItemTexture;
|
||||
}
|
||||
|
||||
public final boolean isItemColored() {
|
||||
return this.itemColored;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,6 @@ public class BlockCake extends Block
|
|||
super(Material.SOFT);
|
||||
this.setDefaultState(this.getBaseState().withProperty(BITES, Integer.valueOf(0)));
|
||||
// this.setTickRandomly(true);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
|
|
|
@ -6,7 +6,7 @@ import common.color.DyeColor;
|
|||
import common.item.CheatTab;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
|
@ -108,10 +108,6 @@ public class BlockCarpet extends Block
|
|||
return side == Facing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side);
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.LAYER;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(this.color.getName() + "_wool").add(0, 0, 0, 16, 1, 16).nswe().uv(0, 15, 16, 16).d().u().noCull();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
|
@ -280,6 +281,10 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
}
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemDoor(this);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import common.item.tool.ItemLead;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
|
@ -195,8 +195,8 @@ public class BlockFence extends Block
|
|||
return new Property[] {NORTH, EAST, WEST, SOUTH};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.FENCE;
|
||||
public Transform getTransform() {
|
||||
return Transform.FENCE;
|
||||
}
|
||||
|
||||
public String getTexture() {
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.CheatTab;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.util.BlockPos;
|
||||
|
@ -146,10 +146,6 @@ public class BlockFenceGate extends Block implements Rotatable
|
|||
return new Property[] {FACING, OPEN, IN_WALL};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.GATE;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return (state.getValue(IN_WALL) ? (state.getValue(OPEN) ? provider.getModel(this.texture).uvLock()
|
||||
.add(0, 2, 7, 2, 13, 9)
|
||||
|
|
|
@ -17,6 +17,7 @@ import common.item.block.ItemBlock;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -110,7 +111,6 @@ public class BlockFlowerPot extends Block
|
|||
super(Material.SMALL);
|
||||
this.content = content;
|
||||
this.setBlockBoundsForItemRender();
|
||||
this.setFlatItemTexture();
|
||||
POTS.add(this);
|
||||
}
|
||||
|
||||
|
@ -262,4 +262,8 @@ public class BlockFlowerPot extends Block
|
|||
protected Item getItemToRegister() {
|
||||
return this.content == null ? super.getItemToRegister() : null;
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.SMALL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -148,4 +149,8 @@ public class BlockLadder extends Block implements Rotatable
|
|||
.s().uv(0, 0, 16, 16).noCull()
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ import common.entity.Entity;
|
|||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemPane;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
|
@ -494,6 +496,14 @@ public class BlockPane extends Block
|
|||
return new Property[] {NORTH, SOUTH, WEST, EAST};
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemPane(this);
|
||||
}
|
||||
|
||||
public String getItemTexture(String name) {
|
||||
return this.getPaneBase();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import common.entity.types.EntityLiving;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -19,7 +20,6 @@ public class BlockSkull extends Block implements Rotatable {
|
|||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
|
@ -55,4 +55,8 @@ public class BlockSkull extends Block implements Rotatable {
|
|||
world.destroyBlock(pos, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.SMALL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import common.item.CheatTab;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
|
@ -783,8 +783,8 @@ public class BlockStairs extends Block implements Rotatable
|
|||
return new Property[] {FACING, HALF, SHAPE};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.STAIRS;
|
||||
public Transform getTransform() {
|
||||
return Transform.STAIRS;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
|
@ -192,10 +192,6 @@ public class BlockTrapDoor extends Block implements Rotatable
|
|||
return this.material == Material.SOLID;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.FLAT;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
Model model;
|
||||
if(state.getValue(OPEN)) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import common.block.Block;
|
|||
import common.init.Blocks;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.vars.Vars;
|
||||
|
@ -85,4 +86,8 @@ public class BlockBlueShroom extends BlockBush
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("blue_mushroom").cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS_SMALL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -248,6 +249,10 @@ public class BlockCocoa extends Block implements Rotatable, IGrowable
|
|||
return model.rotate(ModelRotation.getNorthRot(state.getValue(FACING).getOpposite()));
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemDye(DyeColor.BROWN, this);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import common.item.ItemStack;
|
|||
import common.item.tool.ItemShears;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -75,4 +76,8 @@ public class BlockDeadBush extends BlockBush
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("deadbush").cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import common.item.block.ItemDoublePlant;
|
|||
import common.item.tool.ItemShears;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
|
@ -279,6 +280,10 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
? "top" : "bottom")).cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemDoublePlant(this);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package common.block.foliage;
|
|||
import common.init.Blocks;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Identifyable;
|
||||
|
@ -46,6 +47,10 @@ public class BlockFlower extends BlockBush
|
|||
return provider.getModel(this.type.getName()).cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS_SMALL;
|
||||
}
|
||||
|
||||
public static enum EnumFlowerType implements Identifyable
|
||||
{
|
||||
DANDELION("dandelion", "Löwenzahn"),
|
||||
|
|
|
@ -16,6 +16,7 @@ import common.item.block.ItemLilyPad;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -102,6 +103,10 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
|||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.SMALL_FLAT;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemLilyPad(this);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import common.block.Block;
|
|||
import common.init.Blocks;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.vars.Vars;
|
||||
|
@ -107,4 +108,8 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(name).cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS_SMALL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import common.item.StackSize;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -31,7 +32,6 @@ public class BlockReed extends Block
|
|||
float f = 0.375F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
|
||||
this.setTickRandomly();
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
||||
|
@ -167,4 +167,8 @@ public class BlockReed extends Block
|
|||
protected Item getItemToRegister() {
|
||||
return super.getItemToRegister().setMaxAmount(StackSize.L);
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.init.WoodType;
|
|||
import common.item.CheatTab;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -123,6 +124,10 @@ public class BlockSapling extends BlockBush implements IGrowable
|
|||
return provider.getModel(name).cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS;
|
||||
}
|
||||
|
||||
public WoodType getWoodType() {
|
||||
return this.type;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import common.item.ItemStack;
|
|||
import common.item.tool.ItemShears;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
|
@ -150,6 +151,10 @@ public class BlockTallGrass extends BlockBush implements IGrowable
|
|||
return provider.getModel(this.type.getName()).cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS;
|
||||
}
|
||||
|
||||
public static enum EnumType implements Identifyable
|
||||
{
|
||||
DEAD_BUSH("dead_bush", "Busch"),
|
||||
|
|
|
@ -15,6 +15,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
|
@ -557,6 +558,10 @@ public class BlockVine extends Block
|
|||
}
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {UP};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.ItemStack;
|
|||
import common.item.block.ItemSnow;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -166,10 +166,6 @@ public class BlockSnow extends Block
|
|||
return new Property[] {LAYERS};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.LAYER;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
int height = state.getValue(LAYERS) * 2;
|
||||
return height == 16 ? provider.getModel("snow").add().all() :
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.item.Item;
|
|||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -71,4 +72,8 @@ public class BlockWeb extends Block
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("web").cross();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.CROSS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import common.item.CheatTab;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -126,10 +126,6 @@ public class BlockAnvil extends BlockFalling implements Rotatable
|
|||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.ANVIL;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("anvil_base")
|
||||
.add(2, 0, 2, 14, 4, 14).d().uv(2, 2, 14, 14).rot(180).u().uv(2, 2, 14, 14).rot(180).noCull()
|
||||
|
|
|
@ -353,7 +353,6 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider
|
|||
{
|
||||
super(Material.SOLID);
|
||||
this.setDefaultState(this.getBaseState().withProperty(HAS_BOTTLE[0], Boolean.valueOf(false)).withProperty(HAS_BOTTLE[1], Boolean.valueOf(false)).withProperty(HAS_BOTTLE[2], Boolean.valueOf(false)));
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
|
@ -17,7 +17,7 @@ import common.item.block.ItemButton;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
|
@ -319,10 +319,6 @@ public class BlockButton extends Block implements Directional
|
|||
return this.onTime == 10;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.BUTTON;
|
||||
}
|
||||
|
||||
private static ModelRotation getRotation(Facing face) {
|
||||
switch(face) {
|
||||
case DOWN:
|
||||
|
|
|
@ -412,7 +412,6 @@ public class BlockCauldron extends Block
|
|||
{
|
||||
super(Material.SOLID);
|
||||
this.setDefaultState(this.getBaseState().withProperty(LEVEL, Integer.valueOf(0)));
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.tileentity.TileEntity;
|
||||
|
@ -144,10 +144,6 @@ public class BlockDaylightDetector extends Block implements ITileEntityProvider
|
|||
return new Property[] {POWER};
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.FLAT;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(this.inverted ? "daylight_detector_inverted_top" : "daylight_detector_top")
|
||||
.add(0, 0, 0, 16, 6, 16)
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.item.CheatTab;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -33,7 +34,6 @@ public abstract class BlockDisplay extends Block implements Rotatable
|
|||
this.setBlockBounds(0.0F, 0.0F, 1.0F - 0.0625F, 1.0F, 1.0F, 1.0F);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public int getDensity() {
|
||||
|
@ -119,6 +119,10 @@ public abstract class BlockDisplay extends Block implements Rotatable
|
|||
return provider.getModel("iron_block").add(0, 0, 15, 16, 16, 16).n("display_area").noCull().s().du().we().rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
|
||||
protected abstract BlockDisplay getOtherBlock();
|
||||
|
||||
private boolean test(World world, BlockPos pos, BlockPos origin, Facing dir) {
|
||||
|
|
|
@ -88,7 +88,6 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction
|
|||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.DOWN));
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
|
|
|
@ -11,6 +11,7 @@ import common.item.block.ItemBlock;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.properties.PropertyEnum;
|
||||
|
@ -290,6 +291,10 @@ public class BlockLever extends Block
|
|||
.rotate(getRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
|
||||
public static enum EnumOrientation implements Identifyable, DirectionVec<EnumOrientation>
|
||||
{
|
||||
DOWN_X("down_x", Facing.DOWN),
|
||||
|
|
|
@ -11,6 +11,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyEnum;
|
||||
import common.util.BlockPos;
|
||||
|
@ -215,6 +216,10 @@ public class BlockRail extends Block
|
|||
}
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.SMALL_FLAT;
|
||||
}
|
||||
|
||||
protected void onNeighborChangedInternal(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
if ((new BlockRail.Rail(worldIn, pos, state)).countAdjacentRails() == 3)
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -249,4 +250,8 @@ public abstract class BlockTorch extends Block implements DirectionalUp
|
|||
.s().uv(0, 0, 16, 16).noCull()
|
||||
.rotate(ModelRotation.getEastRot(state.getValue(FACING), false));
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.SMALL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
|
@ -45,7 +46,6 @@ public class BlockTripWire extends Block
|
|||
this.setDefaultState(this.getBaseState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(DISARMED, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
|
||||
// this.setTickRandomly(true);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -656,4 +656,8 @@ public class BlockTripWire extends Block
|
|||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {NORTH, SOUTH, WEST, EAST};
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.THIN_WIRE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
|
@ -556,6 +557,10 @@ public class BlockTripWireHook extends Block implements Rotatable
|
|||
return model.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {SUSPENDED};
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import common.model.BlockLayer;
|
|||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.rng.Random;
|
||||
|
@ -248,7 +249,6 @@ public class BlockWire extends Block
|
|||
super(Material.SMALL);
|
||||
this.setDefaultState(this.getBaseState().withProperty(DOWN, false).withProperty(UP, false).withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false));
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||
this.setFlatItemTexture();
|
||||
}
|
||||
|
||||
public State getActualState(State state, IWorldAccess worldIn, BlockPos pos)
|
||||
|
@ -542,4 +542,8 @@ public class BlockWire extends Block
|
|||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {DOWN, UP, EAST, NORTH, SOUTH, WEST};
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.WIRE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ public final class Star extends Dimension {
|
|||
|
||||
public Star(int color, int radius, float gravity, float temp, BlockStaticLiquid filler) {
|
||||
super(false);
|
||||
this.setPhysics(Planet.radiusToSize(Math.min(radius, 945000000) / 25), 1L, 1L, 0.0f, gravity, temp, 15);
|
||||
this.setPhysics(Planet.radiusToSize(Math.min(radius, 945000000) / 25), 1L, 96000L, 0.0f, gravity, temp, 15);
|
||||
this.setStarBrightness(0.75f).setDeepStarBrightness(0.75f);
|
||||
this.setSkyColor(color).setFogColor(color).setFlatGen(filler.getState(), 128);
|
||||
}
|
||||
|
|
|
@ -2950,7 +2950,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
public boolean isBlocking()
|
||||
{
|
||||
return this.isUsingItem() && this.itemInUse.getItem().getItemUseAction(this.itemInUse) == ItemAction.BLOCK;
|
||||
return this.isUsingItem() && this.itemInUse.getItem().getItemUseAction() == ItemAction.BLOCK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4231,7 +4231,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
for(ItemStack stack : info.items) {
|
||||
if(stack.getItem() instanceof ItemArmor)
|
||||
this.setItem(((ItemArmor)stack.getItem()).armorType.getIndex(), stack);
|
||||
else if(stack.getItem().canBeWielded())
|
||||
else if(stack.getItem().getWieldType() != null)
|
||||
this.setItem(0, stack);
|
||||
else
|
||||
this.extraInventory.addStack(stack);
|
||||
|
|
|
@ -27,17 +27,12 @@ import common.item.Item;
|
|||
import common.item.ItemEffect;
|
||||
import common.item.ItemFragile;
|
||||
import common.item.ItemMagnetic;
|
||||
import common.item.ItemRod;
|
||||
import common.item.ItemSmall;
|
||||
import common.item.ItemStack;
|
||||
import common.item.ItemStick;
|
||||
import common.item.ItemTiny;
|
||||
import common.item.StackSize;
|
||||
import common.item.material.ItemBook;
|
||||
import common.item.material.ItemDye;
|
||||
import common.item.material.ItemEnchantedBook;
|
||||
import common.item.material.ItemMetal;
|
||||
import common.item.material.ItemNugget;
|
||||
import common.item.material.ItemRecord;
|
||||
import common.item.spawner.ItemBoat;
|
||||
import common.item.spawner.ItemMinecart;
|
||||
|
@ -240,8 +235,8 @@ public abstract class ItemRegistry {
|
|||
Item coal = (new Item()).setDisplay("Kohle").setTab(CheatTab.METALS);
|
||||
register("coal", coal);
|
||||
register("charcoal", (new Item()).setDisplay("Holzkohle").setTab(CheatTab.METALS));
|
||||
register("stick", (new ItemStick()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
|
||||
register("bowl", (new ItemSmall()).setDisplay("Schüssel").setTab(CheatTab.MISC));
|
||||
register("stick", (new Item()).setDisplay("Stock").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
|
||||
register("bowl", (new Item()).setDisplay("Schüssel").setTab(CheatTab.MISC));
|
||||
register("mushroom_stew", (new ItemSoup(6)).setDisplay("Pilzsuppe"));
|
||||
register("feather", (new Item()).setDisplay("Feder").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL));
|
||||
register("gunpowder", (new Item()).setDisplay("Schwarzpulver").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
|
||||
|
@ -282,7 +277,7 @@ public abstract class ItemRegistry {
|
|||
lapis = dye;
|
||||
register(color.getDye(), dye);
|
||||
}
|
||||
register("bone", (new ItemStick()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
|
||||
register("bone", (new Item()).setDisplay("Knochen").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.L));
|
||||
register("sugar", (new Item()).setDisplay("Zucker").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XXL));
|
||||
register("cookie", (new ItemFood(2, false)).setDisplay("Keks").setMaxAmount(StackSize.L));
|
||||
register("melon", (new ItemFood(2, false)).setDisplay("Melone"));
|
||||
|
@ -292,9 +287,9 @@ public abstract class ItemRegistry {
|
|||
register("cooked_chicken", (new ItemFood(6, true)).setDisplay("Gebratenes Hühnchen"));
|
||||
register("rotten_flesh", (new ItemFood(4, true)).setDisplay("Verrottetes Fleisch"));
|
||||
register("orb", (new ItemFragile()).setDisplay("Kugel").setTab(CheatTab.MAGIC));
|
||||
register("demon_rod", (new ItemRod()).setDisplay("Dämonenrute").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
|
||||
register("tear", (new ItemTiny()).setDisplay("Träne").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
|
||||
register("gold_nugget", (new ItemNugget()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(StackSize.XL));
|
||||
register("demon_rod", (new Item()).setDisplay("Dämonenrute").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
|
||||
register("tear", (new Item()).setDisplay("Träne").setTab(CheatTab.MATERIALS).setMaxAmount(StackSize.XL));
|
||||
register("gold_nugget", (new Item()).setDisplay("Goldnugget").setTab(CheatTab.METALS).setMaxAmount(StackSize.XL));
|
||||
register("glass_bottle", (new ItemGlassBottle()).setDisplay("Glasflasche"));
|
||||
for(Pair<String, Effect> pot : ItemPotion.getBasePotions()) {
|
||||
register(pot.first(), new ItemPotion(pot.second(), null));
|
||||
|
|
|
@ -32,7 +32,6 @@ import common.item.material.ItemBook;
|
|||
import common.item.material.ItemDye;
|
||||
import common.item.material.ItemEnchantedBook;
|
||||
import common.item.material.ItemMetal;
|
||||
import common.item.material.ItemNugget;
|
||||
import common.item.material.ItemRecord;
|
||||
import common.item.spawner.ItemBoat;
|
||||
import common.item.spawner.ItemMinecart;
|
||||
|
@ -187,7 +186,7 @@ public abstract class Items {
|
|||
public static final ItemSlab blackwood_slab = get("blackwood_slab");
|
||||
public static final ItemBlock blackwood_stairs = get("blackwood_stairs");
|
||||
public static final Item blazing_powder = get("blazing_powder");
|
||||
public static final ItemRod demon_rod = get("demon_rod");
|
||||
public static final Item demon_rod = get("demon_rod");
|
||||
public static final ItemBlock blood_brick = get("blood_brick");
|
||||
public static final ItemFence blood_brick_fence = get("blood_brick_fence");
|
||||
public static final ItemSlab blood_brick_slab = get("blood_brick_slab");
|
||||
|
@ -204,12 +203,12 @@ public abstract class Items {
|
|||
public static final ItemBoat boat = get("boat");
|
||||
public static final ItemAmmo bolt = get("bolt");
|
||||
public static final ItemBoltgun boltgun = get("boltgun");
|
||||
public static final ItemStick bone = get("bone");
|
||||
public static final Item bone = get("bone");
|
||||
public static final ItemDye bonemeal = get("bonemeal");
|
||||
public static final ItemBook book = get("book");
|
||||
public static final ItemBlock bookshelf = get("bookshelf");
|
||||
public static final ItemBow bow = get("bow");
|
||||
public static final ItemSmall bowl = get("bowl");
|
||||
public static final Item bowl = get("bowl");
|
||||
public static final ItemFood bread = get("bread");
|
||||
public static final ItemBlock brewing_stand = get("brewing_stand");
|
||||
public static final Item brick = get("brick");
|
||||
|
@ -375,7 +374,7 @@ public abstract class Items {
|
|||
public static final ItemBlock floor_tiles_white = get("floor_tiles_white");
|
||||
public static final ItemBlock flowerpot = get("flowerpot");
|
||||
public static final ItemBlock furnace = get("furnace");
|
||||
public static final ItemTiny tear = get("tear");
|
||||
public static final Item tear = get("tear");
|
||||
public static final Item ghi_fragment = get("ghi_fragment");
|
||||
public static final ItemBlock glass = get("glass");
|
||||
public static final ItemGlassBottle glass_bottle = get("glass_bottle");
|
||||
|
@ -391,7 +390,7 @@ public abstract class Items {
|
|||
public static final ItemHorseArmor gold_horse_armor = get("gold_horse_armor");
|
||||
public static final ItemMetal gold_ingot = get("gold_ingot");
|
||||
public static final ItemArmor gold_leggings = get("gold_leggings");
|
||||
public static final ItemNugget gold_nugget = get("gold_nugget");
|
||||
public static final Item gold_nugget = get("gold_nugget");
|
||||
public static final ItemMetalBlock gold_ore = get("gold_ore");
|
||||
public static final ItemPickaxe gold_pickaxe = get("gold_pickaxe");
|
||||
public static final ItemShears gold_shears = get("gold_shears");
|
||||
|
@ -743,7 +742,7 @@ public abstract class Items {
|
|||
public static final ItemBlock spruce_sapling = get("spruce_sapling");
|
||||
public static final ItemSlab spruce_slab = get("spruce_slab");
|
||||
public static final ItemBlock spruce_stairs = get("spruce_stairs");
|
||||
public static final ItemStick stick = get("stick");
|
||||
public static final Item stick = get("stick");
|
||||
public static final ItemPiston sticky_piston = get("sticky_piston");
|
||||
public static final ItemBlock stone = get("stone");
|
||||
public static final ItemAxe stone_axe = get("stone_axe");
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.entity.types.EntityLiving;
|
|||
import common.entity.types.IProjectile;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
@ -182,11 +182,11 @@ public class Item {
|
|||
return i < 0 ? 16777215 : i;
|
||||
}
|
||||
|
||||
public ItemAction getItemUseAction(ItemStack stack) {
|
||||
public ItemAction getItemUseAction() {
|
||||
return ItemAction.NONE;
|
||||
}
|
||||
|
||||
public ItemAction getItemPosition(ItemStack stack) {
|
||||
public ItemAction getItemPosition() {
|
||||
return ItemAction.NONE;
|
||||
}
|
||||
|
||||
|
@ -235,12 +235,12 @@ public class Item {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isFirstPerson() {
|
||||
public boolean canRenderHand() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canBeWielded() {
|
||||
return false;
|
||||
public WieldType getWieldType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAdminItem() {
|
||||
|
@ -251,8 +251,8 @@ public class Item {
|
|||
return stack.getColoredName();
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.ITEM;
|
||||
public Transform getTransform() {
|
||||
return Transform.IDENTITY;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package common.item;
|
||||
|
||||
import common.model.Transforms;
|
||||
|
||||
public class ItemRod extends Item {
|
||||
public Transforms getTransform() {
|
||||
return Transforms.ROD;
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package common.item;
|
||||
|
||||
import common.model.Transforms;
|
||||
|
||||
public class ItemSmall extends Item {
|
||||
public Transforms getTransform() {
|
||||
return Transforms.OFFSET1;
|
||||
}
|
||||
}
|
|
@ -217,11 +217,11 @@ public final class ItemStack {
|
|||
}
|
||||
|
||||
public ItemAction getItemUseAction() {
|
||||
return this.item.getItemUseAction(this);
|
||||
return this.item.getItemUseAction();
|
||||
}
|
||||
|
||||
public ItemAction getItemPosition() {
|
||||
return this.item.getItemPosition(this);
|
||||
return this.item.getItemPosition();
|
||||
}
|
||||
|
||||
public int getItemDamage() {
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package common.item;
|
||||
|
||||
import common.model.Transforms;
|
||||
|
||||
public class ItemStick extends Item {
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL;
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package common.item;
|
||||
|
||||
import common.model.Transforms;
|
||||
|
||||
public class ItemTiny extends Item {
|
||||
public Transforms getTransform() {
|
||||
return Transforms.OFFSET2;
|
||||
}
|
||||
}
|
5
common/src/main/java/common/item/WieldType.java
Normal file
5
common/src/main/java/common/item/WieldType.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package common.item;
|
||||
|
||||
public enum WieldType {
|
||||
DEFAULT, TOOL, TOOL_FLIP, RANGED;
|
||||
}
|
|
@ -2,11 +2,16 @@ package common.item.block;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockBed;
|
||||
import common.block.artificial.BlockPane;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
|
@ -87,4 +92,13 @@ public class ItemBed extends Item
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return this.bedBlock.getTransform();
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.bedBlock.getModel(provider,
|
||||
BlockRegistry.getName(this.bedBlock), this.bedBlock.getState().withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD).withProperty(BlockBed.FACING, Facing.NORTH)), this.getTransform());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
@ -110,14 +110,14 @@ public class ItemBlock extends Item
|
|||
return this.block.isMagnetic();
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return this.block.getRenderType() == 2 ? Transforms.DEFAULT : (this.block.hasBlockFlatTexture() || this.block.hasItemFlatTexture() ? super.getTransform() : this.block.getTransform());
|
||||
public Transform getTransform() {
|
||||
return this.block.getRenderType() == 2 ? Transform.IDENTITY : (this.block.hasBlockFlatTexture() ? super.getTransform() : this.block.getTransform());
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
if(this.block.getRenderType() == 2)
|
||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||
return this.block.hasBlockFlatTexture() || this.block.hasItemFlatTexture() ? provider.getModel(this.getTransform(), (this.block.hasBlockFlatTexture() ? "blocks" : "items") + "/" + this.block.getItemTexture(name)) :
|
||||
return this.block.hasBlockFlatTexture() ? provider.getModel(this.getTransform(), "blocks/" + this.block.getItemTexture(name)) :
|
||||
provider.getModel(this.block.getModel(provider,
|
||||
BlockRegistry.getName(this.block), this.block.getState()), this.getTransform());
|
||||
}
|
||||
|
|
|
@ -2,13 +2,18 @@ package common.item.block;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.artificial.BlockBed;
|
||||
import common.block.artificial.BlockDoor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
@ -95,4 +100,13 @@ public class ItemDoor extends Item
|
|||
public boolean isMagnetic() {
|
||||
return this.block == Blocks.iron_door;
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return this.block.getTransform();
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.block.getModel(provider,
|
||||
BlockRegistry.getName(this.block), this.block.getState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER).withProperty(BlockDoor.FACING, Facing.NORTH)), this.getTransform());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.foliage.BlockDoublePlant;
|
||||
import common.block.foliage.BlockDoublePlant.EnumPlantType;
|
||||
import common.color.Colorizer;
|
||||
import common.init.BlockRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.model.Model;
|
||||
|
@ -25,8 +25,7 @@ public class ItemDoublePlant extends ItemBlock
|
|||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.getTransform(), "blocks/" + (
|
||||
this.type == EnumPlantType.SUNFLOWER ? "sunflower_front" :
|
||||
this.type.getName() + "_top"));
|
||||
return provider.getModel(this.block.getModel(provider,
|
||||
BlockRegistry.getName(this.block), this.block.getState().withProperty(BlockDoublePlant.HALF, BlockDoublePlant.EnumBlockHalf.UPPER)), this.getTransform());
|
||||
}
|
||||
}
|
||||
|
|
19
common/src/main/java/common/item/block/ItemPane.java
Normal file
19
common/src/main/java/common/item/block/ItemPane.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package common.item.block;
|
||||
|
||||
import common.block.artificial.BlockPane;
|
||||
import common.init.BlockRegistry;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
||||
public class ItemPane extends ItemBlock
|
||||
{
|
||||
public ItemPane(BlockPane block)
|
||||
{
|
||||
super(block);
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(this.block.getModel(provider,
|
||||
BlockRegistry.getName(this.block), this.block.getState().withProperty(BlockPane.NORTH, false).withProperty(BlockPane.SOUTH, false).withProperty(BlockPane.WEST, true).withProperty(BlockPane.EAST, true)), this.getTransform());
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ import common.entity.npc.EntityNPC;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.World;
|
||||
|
@ -52,8 +52,4 @@ public class ItemSeeds extends Item
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.OFFSET1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package common.item.material;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.artificial.BlockBed;
|
||||
import common.block.foliage.BlockCocoa;
|
||||
import common.block.foliage.IGrowable;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.animal.EntitySheep;
|
||||
|
@ -13,6 +15,9 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -235,4 +240,14 @@ public class ItemDye extends Item {
|
|||
public int getDispenseSoundId() {
|
||||
return this.color == DyeColor.WHITE ? 0 : super.getDispenseSoundId();
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
return this.block == null ? super.getTransform() : this.block.getTransform();
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return this.block == null ? super.getModel(provider, name) :
|
||||
provider.getModel(this.block.getModel(provider,
|
||||
BlockRegistry.getName(this.block), this.block instanceof BlockCocoa ? this.block.getState().withProperty(BlockCocoa.FACING, Facing.SOUTH).withProperty(BlockCocoa.AGE, 2) : this.block.getState()), this.getTransform());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package common.item.material;
|
||||
|
||||
import common.item.Item;
|
||||
import common.model.Transforms;
|
||||
|
||||
public class ItemNugget extends Item {
|
||||
public Transforms getTransform() {
|
||||
return Transforms.NUGGET;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -121,11 +121,6 @@ public class ItemArmor extends Item
|
|||
return this.material.isMagnetic();
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return this.armorType == UsageSlot.HEAD ? Transforms.OFFSET2 : (this.armorType == UsageSlot.FEET ? Transforms.OFFSET1 :
|
||||
super.getTransform());
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
if(this.material.canBeDyed())
|
||||
return provider.getModel(this.getTransform(), name, name + "_overlay");
|
||||
|
|
|
@ -10,7 +10,8 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemBow extends Item
|
||||
|
@ -111,7 +112,7 @@ public class ItemBow extends Item
|
|||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction(ItemStack stack)
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.AIM;
|
||||
}
|
||||
|
@ -154,11 +155,7 @@ public class ItemBow extends Item
|
|||
return null;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.RANGED;
|
||||
}
|
||||
|
||||
public boolean canBeWielded() {
|
||||
return true;
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.RANGED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ItemBucketMilk extends Item
|
|||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction(ItemStack stack)
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.DRINK;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ItemCamera extends ItemMagnetic {
|
|||
// return true;
|
||||
// }
|
||||
|
||||
public boolean isFirstPerson() {
|
||||
public boolean canRenderHand() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemCarrotOnAStick extends Item
|
||||
|
@ -61,7 +62,7 @@ public class ItemCarrotOnAStick extends Item
|
|||
return itemStackIn;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL_FLIP;
|
||||
}
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL_FLIP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import common.item.Item;
|
|||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
|
@ -80,13 +80,13 @@ public class ItemDie extends Item
|
|||
return itemStackIn;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.DICE;
|
||||
public Transform getTransform() {
|
||||
return Transform.DICE;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(provider.getModel("items/die_d" + this.sides + "_side").add().nswe()
|
||||
.du("items/die_d" + this.sides + "_top"), this.getTransform());
|
||||
return provider.getModel(provider.getModel("items/die_d" + this.sides + "_side").add(4.8f, 4.8f, 4.8f, 11.2f, 11.2f, 11.2f).nswe().uv(0, 0, 16, 16)
|
||||
.du("items/die_d" + this.sides + "_top").uv(0, 0, 16, 16), this.getTransform());
|
||||
}
|
||||
|
||||
public ItemStack dispenseStack(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -27,10 +27,6 @@ public class ItemEditor extends Item {
|
|||
return true;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL;
|
||||
}
|
||||
|
||||
public boolean isAdminItem() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import common.init.SoundEvent;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemFishingRod extends Item
|
||||
|
@ -77,7 +78,7 @@ public class ItemFishingRod extends Item
|
|||
return player.fishEntity != null ? "fishing_rod_cast" : null;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL_FLIP;
|
||||
}
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL_FLIP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ItemFood extends Item
|
|||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction(ItemStack stack)
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.EAT;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -25,7 +26,7 @@ public abstract class ItemGunBase extends Item
|
|||
this.setTab(CheatTab.WEAPONS);
|
||||
}
|
||||
|
||||
public ItemAction getItemPosition(ItemStack stack)
|
||||
public ItemAction getItemPosition()
|
||||
{
|
||||
return ItemAction.AIM;
|
||||
}
|
||||
|
@ -78,11 +79,7 @@ public abstract class ItemGunBase extends Item
|
|||
return 1;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.RANGED;
|
||||
}
|
||||
|
||||
public boolean canBeWielded() {
|
||||
return true;
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.RANGED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ import common.init.ToolMaterial;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
|
@ -100,16 +101,12 @@ public class ItemHoe extends Item
|
|||
return this.theToolMaterial.isMagnetic();
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL;
|
||||
}
|
||||
|
||||
public ToolMaterial getToolMaterial()
|
||||
{
|
||||
return this.theToolMaterial;
|
||||
}
|
||||
|
||||
public boolean canBeWielded() {
|
||||
return true;
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package common.item.tool;
|
||||
|
||||
import common.item.ItemMagnetic;
|
||||
import common.model.Transforms;
|
||||
|
||||
public class ItemKey extends ItemMagnetic {
|
||||
public Transforms getTransform() {
|
||||
return Transforms.KEY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@ import common.entity.npc.EntityNPC;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Vec3;
|
||||
import common.world.World;
|
||||
|
@ -65,7 +66,7 @@ public class ItemMagnet extends Item {
|
|||
return true;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL_FLIP;
|
||||
}
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL_FLIP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ public class ItemPotion extends Item
|
|||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction(ItemStack stack)
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.DRINK;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import common.biome.Biome;
|
|||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Vec3;
|
||||
import common.world.AWorldServer;
|
||||
|
@ -24,4 +25,8 @@ public class ItemScanner extends ItemWand {
|
|||
public int getRange(ItemStack stack, EntityNPC player) {
|
||||
return 250;
|
||||
}
|
||||
|
||||
public WieldType getWieldType() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.init.ToolMaterial;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.WieldType;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -56,7 +57,7 @@ public class ItemShears extends Item
|
|||
return this.material.isMagnetic();
|
||||
}
|
||||
|
||||
public boolean canBeWielded() {
|
||||
return true;
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.DEFAULT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package common.item.tool;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.model.Transform;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemSoup extends ItemFood
|
||||
|
@ -23,8 +23,4 @@ public class ItemSoup extends ItemFood
|
|||
super.onItemUseFinish(stack, worldIn, playerIn);
|
||||
return new ItemStack(Items.bowl);
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.OFFSET1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -87,7 +88,7 @@ public class ItemSword extends Item
|
|||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction(ItemStack stack)
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.BLOCK;
|
||||
}
|
||||
|
@ -153,11 +154,7 @@ public class ItemSword extends Item
|
|||
return this.material.isMagnetic();
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL;
|
||||
}
|
||||
|
||||
public boolean canBeWielded() {
|
||||
return true;
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import common.init.ToolMaterial;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -60,11 +61,7 @@ public abstract class ItemTool extends Item {
|
|||
return this.material.isMagnetic();
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL;
|
||||
}
|
||||
|
||||
public boolean canBeWielded() {
|
||||
return true;
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.item.WieldType;
|
||||
import common.model.Transform;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
|
@ -82,7 +83,7 @@ public abstract class ItemWand extends Item {
|
|||
public abstract int getRange(ItemStack stack, EntityNPC player);
|
||||
public abstract void onUse(ItemStack stack, EntityNPC player, AWorldServer world, Vec3 vec);
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.TOOL;
|
||||
}
|
||||
public WieldType getWieldType() {
|
||||
return WieldType.TOOL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import common.util.Facing.Axis;
|
|||
|
||||
public interface ModelProvider {
|
||||
Model getModel(String primary);
|
||||
Model getModel(Transforms transform, String ... layers);
|
||||
Model getModel(Model parent, Transforms transform);
|
||||
Model getModel(Transform transform, String ... layers);
|
||||
Model getModel(Model parent, Transform transform);
|
||||
Model getEntityModel();
|
||||
|
||||
public static class DummyModel extends Model {
|
||||
|
@ -58,11 +58,11 @@ public interface ModelProvider {
|
|||
|
||||
public static class BlockModelProvider {
|
||||
private static ModelProvider provider = new ModelProvider() {
|
||||
public Model getModel(Model parent, Transforms transform) {
|
||||
public Model getModel(Model parent, Transform transform) {
|
||||
return new DummyModel();
|
||||
}
|
||||
|
||||
public Model getModel(Transforms transform, String... layers) {
|
||||
public Model getModel(Transform transform, String... layers) {
|
||||
return new DummyModel();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package common.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import common.collect.Maps;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.Matrix4f;
|
||||
|
@ -27,30 +24,22 @@ public enum ModelRotation
|
|||
X270_Y180(270, 180),
|
||||
X270_Y270(270, 270);
|
||||
|
||||
private static final Map<Integer, ModelRotation> mapRotations = Maps.<Integer, ModelRotation>newHashMap();
|
||||
private final int combinedXY;
|
||||
private final Matrix4f matrix4d;
|
||||
private final int quartersX;
|
||||
private final int quartersY;
|
||||
|
||||
private static int combineXY(int p_177521_0_, int p_177521_1_)
|
||||
private ModelRotation(int x, int y)
|
||||
{
|
||||
return p_177521_0_ * 360 + p_177521_1_;
|
||||
}
|
||||
|
||||
private ModelRotation(int p_i46087_3_, int p_i46087_4_)
|
||||
{
|
||||
this.combinedXY = combineXY(p_i46087_3_, p_i46087_4_);
|
||||
this.matrix4d = new Matrix4f();
|
||||
Matrix4f matrix4f = new Matrix4f();
|
||||
matrix4f.setIdentity();
|
||||
Matrix4f.rotate((float)(-p_i46087_3_) * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f);
|
||||
this.quartersX = ExtMath.absi(p_i46087_3_ / 90);
|
||||
Matrix4f matrix4f1 = new Matrix4f();
|
||||
matrix4f1.setIdentity();
|
||||
Matrix4f.rotate((float)(-p_i46087_4_) * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), matrix4f1, matrix4f1);
|
||||
this.quartersY = ExtMath.absi(p_i46087_4_ / 90);
|
||||
Matrix4f.mul(matrix4f1, matrix4f, this.matrix4d);
|
||||
Matrix4f mat1 = new Matrix4f();
|
||||
mat1.setIdentity();
|
||||
Matrix4f.rotate((float)(-x) * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), mat1, mat1);
|
||||
this.quartersX = ExtMath.absi(x / 90);
|
||||
Matrix4f mat2 = new Matrix4f();
|
||||
mat2.setIdentity();
|
||||
Matrix4f.rotate((float)(-y) * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), mat2, mat2);
|
||||
this.quartersY = ExtMath.absi(y / 90);
|
||||
Matrix4f.mul(mat2, mat1, this.matrix4d);
|
||||
}
|
||||
|
||||
public Matrix4f getMatrix4d()
|
||||
|
@ -58,9 +47,9 @@ public enum ModelRotation
|
|||
return this.matrix4d;
|
||||
}
|
||||
|
||||
public Facing rotateFace(Facing p_177523_1_)
|
||||
public Facing rotateFace(Facing face)
|
||||
{
|
||||
Facing enumfacing = p_177523_1_;
|
||||
Facing enumfacing = face;
|
||||
|
||||
for (int i = 0; i < this.quartersX; ++i)
|
||||
{
|
||||
|
@ -102,11 +91,6 @@ public enum ModelRotation
|
|||
return i;
|
||||
}
|
||||
|
||||
public static ModelRotation getModelRotation(int p_177524_0_, int p_177524_1_)
|
||||
{
|
||||
return (ModelRotation)mapRotations.get(Integer.valueOf(combineXY((p_177524_0_ % 360 + 360) % 360, (p_177524_1_ % 360 + 360) % 360)));
|
||||
}
|
||||
|
||||
public static ModelRotation getNorthRot(Facing face)
|
||||
{
|
||||
switch(face) {
|
||||
|
@ -144,11 +128,4 @@ public enum ModelRotation
|
|||
return X90_Y0;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
for (ModelRotation modelrotation : values())
|
||||
{
|
||||
mapRotations.put(Integer.valueOf(modelrotation.combinedXY), modelrotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,86 @@
|
|||
package common.model;
|
||||
|
||||
public record Transform(float rotationX, float rotationY, float rotationZ, float translationX, float translationY, float translationZ, float scale) {
|
||||
public static final Transform IDENTITY = new Transform(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
public enum Transform {
|
||||
IDENTITY(
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f
|
||||
),
|
||||
DICE(
|
||||
135.0f, -55.0f, 180.0f, 0.0f, 0.0f, 0.0f, 2.75f
|
||||
),
|
||||
STAIRS(
|
||||
0.0f, 180.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f
|
||||
),
|
||||
SMALL(
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.25f, 0.0f, 1.25f
|
||||
),
|
||||
SMALL_FLAT(
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 1.5f, 0.0f, 1.25f
|
||||
),
|
||||
CROSS(
|
||||
0.0f, 45.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.25f
|
||||
),
|
||||
CROSS_SMALL(
|
||||
0.0f, 45.0f, 0.0f, 0.0f, 0.5f, 0.0f, 1.5f
|
||||
),
|
||||
WIRE(
|
||||
90.0f, 45.0f, -90.0f, 0.0f, -4.0f, 0.0f, 1.75f
|
||||
),
|
||||
THIN_WIRE(
|
||||
50.0f, 45.0f, -50.0f, 5.0f, 1.75f, 0.0f, 2.25f
|
||||
),
|
||||
PANE(
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.25f
|
||||
),
|
||||
PANE_SIDE(
|
||||
0.0f, 0.0f, 0.0f, -4.5f, -3.75f, 0.0f, 1.25f
|
||||
),
|
||||
FENCE(
|
||||
0.0f, 90.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f
|
||||
);
|
||||
|
||||
private final float rotationX;
|
||||
private final float rotationY;
|
||||
private final float rotationZ;
|
||||
private final float translationX;
|
||||
private final float translationY;
|
||||
private final float translationZ;
|
||||
private final float scale;
|
||||
|
||||
private Transform(float rx, float ry, float rz, float tx, float ty, float tz, float scale) {
|
||||
this.rotationX = rx;
|
||||
this.rotationY = ry;
|
||||
this.rotationZ = rz;
|
||||
this.translationX = tx * 0.0625f;
|
||||
this.translationY = ty * 0.0625f;
|
||||
this.translationZ = tz * 0.0625f;
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public float rotationX() {
|
||||
return this.rotationX;
|
||||
}
|
||||
|
||||
public float rotationY() {
|
||||
return this.rotationY;
|
||||
}
|
||||
|
||||
public float rotationZ() {
|
||||
return this.rotationZ;
|
||||
}
|
||||
|
||||
public float translationX() {
|
||||
return this.translationX;
|
||||
}
|
||||
|
||||
public float translationY() {
|
||||
return this.translationY;
|
||||
}
|
||||
|
||||
public float translationZ() {
|
||||
return this.translationZ;
|
||||
}
|
||||
|
||||
public float scale() {
|
||||
return this.scale;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
package common.model;
|
||||
|
||||
public enum Transforms {
|
||||
DEFAULT(
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
ANVIL(
|
||||
transform(10.0f, -45.0f, 170.0f, 0.25f, 1.5f, -2.5f, 0.375f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
BLOCK(
|
||||
transform(10.0f, -45.0f, 170.0f, 0.0f, 1.5f, -2.75f, 0.375f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
ITEM(
|
||||
transform(-90.0f, 0.0f, 0.0f, 0.0f, 1.0f, -3.0f, 0.55f),
|
||||
transform(0.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
TOOL_FLIP(
|
||||
transform(180.0f, 90.0f, -35.0f, 0.0f, 0.0f, -3.5f, 0.85f),
|
||||
transform(0.0f, 45.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
TOOL(
|
||||
transform(0.0f, 90.0f, -35.0f, 0.0f, 1.25f, -3.5f, 0.85f),
|
||||
transform(0.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
OFFSET2(
|
||||
transform(-90.0f, 0.0f, 0.0f, 0.0f, 1.0f, -2.25f, 0.55f),
|
||||
transform(0.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
LAYER(
|
||||
transform(10.0f, -45.0f, 170.0f, 0.0f, 0.25f, -2.75f, 0.375f),
|
||||
transform(0.0f, 0.0f, 0.0f, 0.0f, 5.25f, 0.0f, 1.0f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
DICE(
|
||||
transform(10.0f, -45.0f, 170.0f, 0.0f, 1.5f, -1.75f, 0.15f),
|
||||
transform(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.4f),
|
||||
transform(135.0f, -55.0f, 180.0f, 0.0f, 0.0f, 0.0f, 1.1f),
|
||||
transform(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.4f)
|
||||
),
|
||||
STAIRS(
|
||||
transform(10.0f, -45.0f, 170.0f, 0.0f, 1.5f, -2.75f, 0.375f),
|
||||
Transform.IDENTITY,
|
||||
transform(0.0f, 180.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f),
|
||||
Transform.IDENTITY
|
||||
),
|
||||
OFFSET1(
|
||||
transform(-90.0f, 0.0f, 0.0f, 0.0f, 1.0f, -2.5f, 0.55f),
|
||||
transform(0.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
GATE(
|
||||
transform(0.0f, -90.0f, 170.0f, 0.0f, 1.5f, -2.75f, 0.375f),
|
||||
transform(0.0f, 90.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
NUGGET(
|
||||
transform(-90.0f, 0.0f, 0.0f, 0.0f, 1.0f, -2.0f, 0.55f),
|
||||
transform(0.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
SKULL(
|
||||
transform(180.0f, -45.0f, 0.0f, 0.0f, 1.0f, -2.5f, 0.25f),
|
||||
transform(0.0f, -180.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.55f),
|
||||
transform(0.0f, 180.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.7f),
|
||||
Transform.IDENTITY
|
||||
),
|
||||
BUTTON(
|
||||
transform(10.0f, -45.0f, 170.0f, 0.0f, 1.0f, -1.75f, 0.375f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
RANGED(
|
||||
transform(5.0f, 80.0f, -45.0f, 0.75f, 0.0f, 0.25f, 1.0f),
|
||||
transform(0.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
FENCE(
|
||||
transform(0.0f, 0.0f, 180.0f, 0.0f, 1.5f, -2.75f, 0.375f),
|
||||
Transform.IDENTITY,
|
||||
transform(0.0f, 90.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f),
|
||||
Transform.IDENTITY
|
||||
),
|
||||
FLAT(
|
||||
transform(10.0f, -45.0f, 170.0f, 0.0f, 0.25f, -2.75f, 0.375f),
|
||||
transform(0.0f, 0.0f, 0.0f, 0.0f, 5.0f, 0.0f, 1.0f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
ROD(
|
||||
transform(0.0f, 90.0f, -35.0f, 0.0f, 0.75f, -3.5f, 0.85f),
|
||||
transform(0.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
),
|
||||
KEY(
|
||||
transform(0.0f, 270.0f, -35.0f, 0.0f, 1.25f, -3.5f, 0.85f),
|
||||
transform(180.0f, -135.0f, 25.0f, 0.0f, 4.0f, 2.0f, 1.7f),
|
||||
Transform.IDENTITY,
|
||||
Transform.IDENTITY
|
||||
);
|
||||
|
||||
public static enum Camera {
|
||||
NONE,
|
||||
THIRD_PERSON,
|
||||
FIRST_PERSON,
|
||||
GUI,
|
||||
GROUND;
|
||||
}
|
||||
|
||||
private static Transform transform(float rx, float ry, float rz, float tx, float ty, float tz, float scale) {
|
||||
return new Transform(rx, ry, rz, tx * 0.0625f, ty * 0.0625f, tz * 0.0625f, scale);
|
||||
}
|
||||
|
||||
public final Transform third;
|
||||
public final Transform first;
|
||||
public final Transform gui;
|
||||
public final Transform ground;
|
||||
|
||||
private Transforms(Transform third, Transform first, Transform gui, Transform ground) {
|
||||
this.third = third;
|
||||
this.first = first;
|
||||
this.gui = gui;
|
||||
this.ground = ground;
|
||||
}
|
||||
|
||||
public Transform get(Camera type) {
|
||||
switch(type) {
|
||||
case THIRD_PERSON:
|
||||
return this.third;
|
||||
case FIRST_PERSON:
|
||||
return this.first;
|
||||
case GUI:
|
||||
return this.gui;
|
||||
case GROUND:
|
||||
return this.ground;
|
||||
default:
|
||||
return Transform.IDENTITY;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue