broken shield just the item not even going to fix yet tho

This commit is contained in:
Aether 2024-10-16 14:58:19 -04:00
parent a9d2443fd4
commit d508fad79b
10 changed files with 194 additions and 3 deletions

View File

@ -0,0 +1,30 @@
{
"parent": "builtin/entity",
"display": {
"thirdperson": {
"rotation": [ 0, 90, 0 ],
"translation": [ 10.51, 6, -4 ],
"scale": [ 1, 1, 1 ]
},
"firstperson": {
"rotation": [ 0, 180, 5 ],
"translation": [ -10, 2, -10 ],
"scale": [ 1.25, 1.25, 1.25 ]
},
"gui": {
"rotation": [ 15, -25, -5 ],
"translation": [ 2, 3, 0 ],
"scale": [ 0.65, 0.65, 0.65 ]
},
"fixed": {
"rotation": [ 0, 180, 0 ],
"translation": [ -2, 4, -5],
"scale":[ 0.5, 0.5, 0.5]
},
"ground": {
"rotation": [ 0, 0, 0 ],
"translation": [ 4, 4, 2],
"scale":[ 0.25, 0.25, 0.25]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,23 @@
package net.minecraft.client.model;
public class ModelShield extends ModelBase
{
public ModelRenderer plate;
public ModelRenderer handle;
public ModelShield()
{
this.textureWidth = 64;
this.textureHeight = 64;
this.plate = new ModelRenderer(this, 0, 0);
this.plate.addBox(-6.0F, -11.0F, -2.0F, 12, 22, 1, 0.0F);
this.handle = new ModelRenderer(this, 26, 0);
this.handle.addBox(-1.0F, -3.0F, -1.0F, 2, 6, 6, 0.0F);
}
public void render()
{
this.plate.render(0.0625F);
this.handle.render(0.0625F);
}
}

View File

@ -79,9 +79,9 @@ public class ItemTransformVec3f {
Vector3f vector3f = this.parseVector3f(jsonobject, "rotation", ROTATION_DEFAULT);
Vector3f vector3f1 = this.parseVector3f(jsonobject, "translation", TRANSLATION_DEFAULT);
vector3f1.scale(0.0625F);
vector3f1.x = MathHelper.clamp_float(vector3f1.x, -1.5F, 1.5F);
vector3f1.y = MathHelper.clamp_float(vector3f1.y, -1.5F, 1.5F);
vector3f1.z = MathHelper.clamp_float(vector3f1.z, -1.5F, 1.5F);
vector3f1.x = MathHelper.clamp_float(vector3f1.x, -5.0F, 5.0F);
vector3f1.y = MathHelper.clamp_float(vector3f1.y, -5.0F, 5.0F);
vector3f1.z = MathHelper.clamp_float(vector3f1.z, -5.0F, 5.0F);
Vector3f vector3f2 = this.parseVector3f(jsonobject, "scale", SCALE_DEFAULT);
vector3f2.x = MathHelper.clamp_float(vector3f2.x, -4.0F, 4.0F);
vector3f2.y = MathHelper.clamp_float(vector3f2.y, -4.0F, 4.0F);

View File

@ -1164,6 +1164,15 @@ public class RenderItem implements IResourceManagerReloadListener {
this.registerBlock(EaglerItems.getEaglerBlock("purpur_slab"), BlockPurpurSlab.EnumType.DEFAULT.getMetadata(),
"purpur_slab");
// this.itemModelMesher.register(EaglerItems.getEaglerItem("shield"), new ItemMeshDefinition()
// {
// public ModelResourceLocation getModelLocation(ItemStack stack)
// {
// return new ModelResourceLocation("shield", "inventory");
// }
// });
// TODO: Make custom slabs not have to be registered manually
for (Map.Entry<String, EaglerCustomBlock> entry : EaglerItems.getEaglerCustomBlockEntries()) {
if (entry.getValue().isSlab() || !entry.getValue().hasItem()) {
@ -1173,6 +1182,9 @@ public class RenderItem implements IResourceManagerReloadListener {
}
for (Map.Entry<String, Item> entry : EaglerItems.getEaglerItemEntries()) {
if (!EaglerItems.shouldRegisterModel(entry.getKey())) {
continue;
}
this.registerItem(entry.getValue(), entry.getKey());
}
}

View File

@ -1,10 +1,13 @@
package net.minecraft.client.renderer.tileentity;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelShield;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@ -15,6 +18,7 @@ import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityEnderChest;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
/**
* +
@ -52,11 +56,23 @@ public class TileEntityItemStackRenderer {
private TileEntityEnderChest enderChest = new TileEntityEnderChest();
private TileEntityBanner banner = new TileEntityBanner();
private TileEntitySkull skull = new TileEntitySkull();
private ModelShield modelShield = new ModelShield();
public static final ResourceLocation SHIELD_BASE_TEXTURE = new ResourceLocation("textures/entity/shield_base_nopattern.png");
public void renderByItem(ItemStack itemStackIn) {
if (itemStackIn.getItem() == Items.banner) {
this.banner.setItemValues(itemStackIn);
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
} else if (itemStackIn.getItem() == EaglerItems.getEaglerItem("shield")) {
{
Minecraft.getMinecraft().getTextureManager().bindTexture(SHIELD_BASE_TEXTURE);
GlStateManager.pushMatrix();
GlStateManager.scale(1.0F, -1.0F, -1.0F);
this.modelShield.render();
GlStateManager.popMatrix();
}
} else if (itemStackIn.getItem() == Items.skull) {
GameProfile gameprofile = null;
if (itemStackIn.hasTagCompound()) {

View File

@ -1161,6 +1161,9 @@ public class Item {
.setUnlocalizedName("beetroot_seeds"));
registerEaglerItem(436, "beetroot_soup", (new ItemSoup(6)).setUnlocalizedName("beetroot_soup"));
registerEaglerItem(443, "elytra", (new ItemElytra()).setUnlocalizedName("elytra"));
// registerEaglerItem(442, "shield", (new ItemShield()).setUnlocalizedName("shield"), false);
}
/**
@ -1194,6 +1197,11 @@ public class Item {
registerItem(id, textualID, itemIn);
}
protected static void registerEaglerItem(int id, String textualID, Item itemIn, boolean registerModel) {
EaglerItems.registerEaglerItem(textualID, itemIn, registerModel);
registerItem(id, textualID, itemIn);
}
public static enum ToolMaterial {
WOOD(0, 59, 2.0F, 0.0F, 15),
STONE(1, 131, 4.0F, 1.0F, 5),

View File

@ -0,0 +1,91 @@
package net.minecraft.item;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class ItemShield extends Item
{
public ItemShield()
{
this.maxStackSize = 1;
this.setCreativeTab(CreativeTabs.tabCombat);
this.setMaxDamage(336);
// this.addPropertyOverride(new ResourceLocation("blocking"), new IItemPropertyGetter()
// {
// public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
// {
// return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
// }
// });
}
// /**
// * Called when a Block is right-clicked with this Item
// */
// public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
// {
// return super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
// }
/**
* allows items to add custom lines of information to the mouseover description
*/
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
// ItemBanner.appendHoverTextFromTileEntityTag(stack, tooltip);
}
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
ItemStack itemstack = new ItemStack(itemIn, 1, 0);
subItems.add(itemstack);
}
/**
* gets the CreativeTab this item is displayed on
*/
public CreativeTabs getCreativeTab()
{
return CreativeTabs.tabCombat;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack stack)
{
return EnumAction.BLOCK;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack stack)
{
return 72000;
}
// public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
// {
// playerIn.setActiveHand(hand);
// return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
// }
// /**
// * Return whether this item is repairable in an anvil.
// */
// public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
// {
// return repair.getItem() == Item.getItemFromBlock(Blocks.PLANKS) ? true : super.getIsRepairable(toRepair, repair);
// }
}

View File

@ -12,6 +12,7 @@ import net.minecraft.item.Item;
public class EaglerItems {
protected static Map<String, EaglerCustomBlock> blockMap = new HashMap<>();
protected static Map<String, Item> itemMap = new HashMap<>();
protected static Map<String, Boolean> itemModelRegisterMap = new HashMap<>();
public static void registerEaglerBlock(String id, Block block) {
blockMap.put(id, new EaglerCustomBlock(block));
@ -27,6 +28,12 @@ public class EaglerItems {
public static void registerEaglerItem(String id, Item item) {
itemMap.put(id, item);
itemModelRegisterMap.put(id, true);
}
public static void registerEaglerItem(String id, Item item, boolean registerModel) {
itemMap.put(id, item);
itemModelRegisterMap.put(id, registerModel);
}
public static EaglerCustomBlock getEaglerCustomBlock(String id) {
@ -76,4 +83,8 @@ public class EaglerItems {
public static List<Map.Entry<String, Item>> getEaglerItemEntries() {
return new ArrayList<>(itemMap.entrySet());
}
public static boolean shouldRegisterModel(String id) {
return itemModelRegisterMap.get(id);
}
}