Merge remote-tracking branch 'origin/main' into frozen
@ -1,138 +0,0 @@
|
||||
package com.zivilon.cinder_loe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lotr.common.LOTRAchievement;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
import lotr.common.world.LOTRWorldProvider;
|
||||
import lotr.common.world.LOTRWorldProviderMiddleEarth;
|
||||
import lotr.common.world.LOTRWorldProviderUtumno;
|
||||
import lotr.common.world.biome.LOTRBiome;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public enum CinderDimension {
|
||||
ISLAND("Island", 101, LOTRWorldProviderMiddleEarth.class, false, 500, EnumSet.of(DimensionRegion.REG));
|
||||
|
||||
public String dimensionName;
|
||||
private int defaultID;
|
||||
public int dimensionID;
|
||||
private Class providerClass;
|
||||
private boolean loadSpawn;
|
||||
public LOTRBiome[] biomeList = new LOTRBiome[256];
|
||||
public Map<Integer, Integer> colorsToBiomeIDs = new HashMap<Integer, Integer>();
|
||||
public List<LOTRBiome> majorBiomes = new ArrayList<LOTRBiome>();
|
||||
public List<LOTRAchievement.Category> achievementCategories = new ArrayList<LOTRAchievement.Category>();
|
||||
public List<LOTRAchievement> allAchievements = new ArrayList<LOTRAchievement>();
|
||||
public List<LOTRFaction> factionList = new ArrayList<LOTRFaction>();
|
||||
public List<CinderDimension.DimensionRegion> dimensionRegions = new ArrayList<CinderDimension.DimensionRegion>();
|
||||
public int spawnCap;
|
||||
|
||||
private CinderDimension(String s, int i, Class c, boolean flag, int spawns, EnumSet<DimensionRegion> regions) {
|
||||
this.dimensionName = s;
|
||||
this.defaultID = i;
|
||||
this.providerClass = c;
|
||||
this.loadSpawn = flag;
|
||||
this.spawnCap = spawns;
|
||||
this.dimensionRegions.addAll(regions);
|
||||
for (DimensionRegion r : this.dimensionRegions) {
|
||||
r.setDimension(this);
|
||||
}
|
||||
}
|
||||
public String getUntranslatedDimensionName() {
|
||||
return "lotr.dimension." + this.dimensionName;
|
||||
}
|
||||
|
||||
public String getDimensionName() {
|
||||
return StatCollector.translateToLocal((String)this.getUntranslatedDimensionName());
|
||||
}
|
||||
|
||||
public static void configureDimensions(Configuration config, String category) {
|
||||
for (CinderDimension dim : CinderDimension.values()) {
|
||||
dim.dimensionID = config.get(category, "Dimension ID: " + dim.dimensionName, dim.defaultID).getInt();
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerDimensions() {
|
||||
for (CinderDimension dim : CinderDimension.values()) {
|
||||
DimensionManager.registerProviderType((int)dim.dimensionID, (Class)dim.providerClass, (boolean)dim.loadSpawn);
|
||||
DimensionManager.registerDimension((int)dim.dimensionID, (int)dim.dimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
public static CinderDimension getCurrentDimension(World world) {
|
||||
WorldProvider provider;
|
||||
if (world != null && (provider = world.provider) instanceof LOTRWorldProvider) {
|
||||
return ((LOTRWorldProvider)provider).getLOTRDimension();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CinderDimension getCurrentDimensionWithFallback(World world) {
|
||||
CinderDimension dim = CinderDimension.getCurrentDimension(world);
|
||||
if (dim == null) {
|
||||
return ISLAND;
|
||||
}
|
||||
return dim;
|
||||
}
|
||||
|
||||
public static CinderDimension forName(String s) {
|
||||
for (CinderDimension dim : CinderDimension.values()) {
|
||||
if (!dim.dimensionName.equals(s)) continue;
|
||||
return dim;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static enum DimensionRegion {
|
||||
REG("island");
|
||||
|
||||
private String regionName;
|
||||
private CinderDimension dimension;
|
||||
public List<LOTRFaction> factionList = new ArrayList<LOTRFaction>();
|
||||
|
||||
private DimensionRegion(String s) {
|
||||
this.regionName = s;
|
||||
}
|
||||
|
||||
public void setDimension(CinderDimension dim) {
|
||||
this.dimension = dim;
|
||||
}
|
||||
|
||||
public CinderDimension getDimension() {
|
||||
return this.dimension;
|
||||
}
|
||||
|
||||
public String codeName() {
|
||||
return this.regionName;
|
||||
}
|
||||
|
||||
public String getRegionName() {
|
||||
return StatCollector.translateToLocal((String)("lotr.dimension." + this.dimension.dimensionName + "." + this.codeName()));
|
||||
}
|
||||
|
||||
public static DimensionRegion forName(String regionName) {
|
||||
for (DimensionRegion r : DimensionRegion.values()) {
|
||||
if (!r.codeName().equals(regionName)) continue;
|
||||
return r;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DimensionRegion forID(int ID) {
|
||||
for (DimensionRegion r : DimensionRegion.values()) {
|
||||
if (r.ordinal() != ID) continue;
|
||||
return r;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,50 +0,0 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import lotr.common.LOTRMod;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class onionCrop
|
||||
extends BlockCrops {
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
private IIcon[] onionIcons;
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public IIcon getIcon(int i, int j) {
|
||||
if (j < 7) {
|
||||
if (j == 6) {
|
||||
j = 5;
|
||||
}
|
||||
return this.onionIcons[j >> 1];
|
||||
}
|
||||
return this.onionIcons[3];
|
||||
}
|
||||
|
||||
@SideOnly(value=Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconregister) {
|
||||
this.onionIcons = new IIcon[4];
|
||||
for (int i = 0; i < this.onionIcons.length; ++i) {
|
||||
this.onionIcons[i] = iconregister.registerIcon(this.getTextureName() + "_" + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Item func_149866_i() {
|
||||
return CinderLoE.onion;
|
||||
}
|
||||
|
||||
public Item func_149865_P() {
|
||||
return CinderLoE.onion;
|
||||
}
|
||||
|
||||
public EnumPlantType getPlantType(IBlockAccess world, int i, int j, int k) {
|
||||
return EnumPlantType.Crop;
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,8 @@
|
||||
package com.zivilon.cinder_loe.blocks;
|
||||
package com.zivilon.cinder_loe.blocks.plants;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import lotr.common.LOTRMod;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
@ -0,0 +1,206 @@
|
||||
package com.zivilon.cinder_loe.coremod;
|
||||
|
||||
import com.zivilon.cinder_loe.world.CinderWorldProviderIsland;
|
||||
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.TypeInsnNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LOTRDimensionAdder implements IClassTransformer {
|
||||
public static List<DimensionInfo> custom_dimensions = new ArrayList<>();
|
||||
|
||||
// This is where you add new dimensions
|
||||
public void registerDimensions() {
|
||||
System.out.println("Registering dimensions");
|
||||
custom_dimensions = new ArrayList<>();
|
||||
// register("ISLAND", "Island", 102, CinderWorldProviderIsland.class, 100);
|
||||
}
|
||||
|
||||
// The ASM code you shouldn't touch
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if ("lotr.common.LOTRDimension".equals(transformedName)) {
|
||||
registerDimensions();
|
||||
if (custom_dimensions.isEmpty()) return basicClass;
|
||||
|
||||
// Get class
|
||||
ClassReader classReader = new ClassReader(basicClass);
|
||||
ClassNode classNode = new ClassNode();
|
||||
classReader.accept(classNode, 0);
|
||||
|
||||
|
||||
// Add the new enum constant
|
||||
for (DimensionInfo dimension : custom_dimensions) {
|
||||
FieldNode newEnumConstant = new FieldNode(
|
||||
Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL + Opcodes.ACC_ENUM,
|
||||
dimension.enum_name,
|
||||
"Llotr/common/LOTRDimension;",
|
||||
null,
|
||||
null
|
||||
);
|
||||
classNode.fields.add(newEnumConstant);
|
||||
}
|
||||
|
||||
|
||||
// Locate <clinit>
|
||||
MethodNode clinit = null;
|
||||
for (MethodNode method : classNode.methods) {
|
||||
if ("<clinit>".equals(method.name)) {
|
||||
clinit = method;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InsnList insns = clinit.instructions;
|
||||
AbstractInsnNode constructor_injection_point = null;
|
||||
|
||||
for (AbstractInsnNode insn : clinit.instructions.toArray()) {
|
||||
if (insn.getOpcode() == Opcodes.ICONST_2) {
|
||||
constructor_injection_point = insn;
|
||||
int list_size = 2 + custom_dimensions.size();
|
||||
IntInsnNode push_size = new IntInsnNode(Opcodes.BIPUSH, 2 + custom_dimensions.size());
|
||||
clinit.instructions.insert(insn, push_size);
|
||||
clinit.instructions.remove(insn);
|
||||
constructor_injection_point = push_size;
|
||||
System.out.println("LOTRDimension list size: " + list_size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create the constructor instructions to add new dimension
|
||||
InsnList constructor_injection = new InsnList();
|
||||
int i = 2;
|
||||
for (DimensionInfo dimension : custom_dimensions) {
|
||||
System.out.println("Registering with enum " + dimension.enum_name);
|
||||
System.out.println("Registering with ordinal " + i);
|
||||
System.out.println("Registering with name " + dimension.dimension_name);
|
||||
System.out.println("Registering with ID " + dimension.dimension_id);
|
||||
|
||||
constructor_injection.add(new TypeInsnNode(Opcodes.NEW, "lotr/common/LOTRDimension"));
|
||||
constructor_injection.add(new InsnNode(Opcodes.DUP));
|
||||
constructor_injection.add(new LdcInsnNode(dimension.enum_name));
|
||||
constructor_injection.add(new IntInsnNode(Opcodes.BIPUSH, i));
|
||||
constructor_injection.add(new LdcInsnNode(dimension.dimension_name));
|
||||
constructor_injection.add(new IntInsnNode(Opcodes.BIPUSH, dimension.dimension_id));
|
||||
constructor_injection.add(new LdcInsnNode(Type.getType(dimension.world_provider))); // World provider class
|
||||
constructor_injection.add(new InsnNode(Opcodes.ICONST_0)); // Do not load spawn persistently
|
||||
constructor_injection.add(new IntInsnNode(Opcodes.BIPUSH, dimension.spawn_limit)); // Set spawn cap for dimension
|
||||
|
||||
// Add no DimensionRegions
|
||||
constructor_injection.add(new LdcInsnNode(Type.getType("Llotr/common/LOTRDimension$DimensionRegion;")));
|
||||
constructor_injection.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/util/EnumSet", "noneOf", "(Ljava/lang/Class;)Ljava/util/EnumSet;", false));
|
||||
|
||||
// Add PUTSTATIC
|
||||
constructor_injection.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "lotr/common/LOTRDimension", "<init>", "(Ljava/lang/String;ILjava/lang/String;ILjava/lang/Class;ZILjava/util/EnumSet;)V", false));
|
||||
constructor_injection.add(new FieldInsnNode(Opcodes.PUTSTATIC, "lotr/common/LOTRDimension", dimension.enum_name, "Llotr/common/LOTRDimension;"));
|
||||
i++;
|
||||
}
|
||||
// Insert the new instructions
|
||||
if (constructor_injection_point != null) {
|
||||
insns.insertBefore(constructor_injection_point, constructor_injection);
|
||||
}
|
||||
|
||||
// Modifying the $VALUES array
|
||||
// Create new instruction list to be injected later
|
||||
InsnList values_array_injection = new InsnList();
|
||||
|
||||
// Add instructions to the instruction list
|
||||
i = 2;
|
||||
for (DimensionInfo dimension : custom_dimensions) {
|
||||
values_array_injection.add(new InsnNode(Opcodes.DUP));
|
||||
values_array_injection.add(new IntInsnNode(Opcodes.BIPUSH, i));
|
||||
values_array_injection.add(new FieldInsnNode(Opcodes.GETSTATIC, "lotr/common/LOTRDimension", dimension.enum_name, "Llotr/common/LOTRDimension;"));
|
||||
values_array_injection.add(new InsnNode(Opcodes.AASTORE));
|
||||
i++;
|
||||
}
|
||||
|
||||
// Find the putstatic instruction for $VALUES
|
||||
// This is where the fields are injected into a list, we want to inject our instructions before this
|
||||
AbstractInsnNode values_injection_point = null;
|
||||
|
||||
AbstractInsnNode cursor = constructor_injection_point;
|
||||
while (cursor != null) {
|
||||
if (cursor.getOpcode() == Opcodes.PUTSTATIC) {
|
||||
values_injection_point = cursor;
|
||||
break;
|
||||
}
|
||||
cursor = cursor.getNext();
|
||||
}
|
||||
if (values_injection_point == null) {
|
||||
throw new RuntimeException("[CinderLoE] Could not locate $VALUES PUTSTATIC injection point for LOTRDimension!");
|
||||
}
|
||||
|
||||
// Insert the new instructions before the putstatic instruction
|
||||
if (values_injection_point != null) {
|
||||
insns.insertBefore(values_injection_point, values_array_injection);
|
||||
}
|
||||
|
||||
// Write the modified class back to a byte array
|
||||
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
classNode.accept(classWriter);
|
||||
return classWriter.toByteArray(); // Return the modified class
|
||||
}
|
||||
return basicClass; // Return the unmodified class for all other classes
|
||||
}
|
||||
|
||||
public void register(String enum_name, String dimension_name, int dimension_id, Class<?> world_provider, int spawn_limit) {
|
||||
System.out.println("Registering dimension " + enum_name + " " + dimension_name + " with ID " + dimension_id);
|
||||
custom_dimensions.add(new DimensionInfo(enum_name, dimension_name, dimension_id, world_provider, spawn_limit));
|
||||
}
|
||||
|
||||
public class DimensionInfo {
|
||||
String enum_name;
|
||||
String dimension_name;
|
||||
int dimension_id;
|
||||
Class<?> world_provider;
|
||||
int spawn_limit;
|
||||
|
||||
public DimensionInfo(String enum_name, String dimension_name, int dimension_id, Class<?> world_provider, int spawn_limit) {
|
||||
this.enum_name = enum_name;
|
||||
this.dimension_name = dimension_name;
|
||||
this.dimension_id = dimension_id;
|
||||
this.world_provider = world_provider;
|
||||
this.spawn_limit = spawn_limit;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Reference
|
||||
|
||||
|
||||
L0: new lotr/common/LOTRDimension
|
||||
L3: dup
|
||||
L4: ldc 'MIDDLE_EARTH'
|
||||
L6: iconst_0
|
||||
L7: ldc 'MiddleEarth'
|
||||
L9: bipush 100
|
||||
L11: ldc Class lotr/common/world/LOTRWorldProviderMiddleEarth
|
||||
L13: iconst_1
|
||||
L14: bipush 100
|
||||
L16: getstatic Field lotr/common/LOTRDimension$DimensionRegion WEST Llotr/common/LOTRDimension$DimensionRegion;
|
||||
L19: getstatic Field lotr/common/LOTRDimension$DimensionRegion EAST Llotr/common/LOTRDimension$DimensionRegion;
|
||||
L22: getstatic Field lotr/common/LOTRDimension$DimensionRegion SOUTH Llotr/common/LOTRDimension$DimensionRegion;
|
||||
L25: invokestatic Method java/util/EnumSet of (Ljava/lang/Enum;Ljava/lang/Enum;Ljava/lang/Enum;)Ljava/util/EnumSet;
|
||||
L28: invokespecial Method lotr/common/LOTRDimension <init> (Ljava/lang/String;ILjava/lang/String;ILjava/lang/Class;ZILjava/util/EnumSet;)V
|
||||
L31: putstatic Field lotr/common/LOTRDimension MIDDLE_EARTH Llotr/common/LOTRDimension;
|
||||
L34: new lotr/common/LOTRDimension
|
||||
|
||||
*/
|
||||
@ -0,0 +1,62 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FieldRepairKit extends ItemFood {
|
||||
|
||||
private int damageAmount;
|
||||
public FieldRepairKit() {
|
||||
super(0, 0.0F, false); // No hunger, no saturation
|
||||
this.setAlwaysEdible(); // Allow eating even at full hunger
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
world.playSoundAtEntity(player, "random.anvil_break", 1.0F, 1.0F);
|
||||
}
|
||||
return super.onEaten(stack, world, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ItemStack armor = player.getCurrentArmor(i);
|
||||
if (armor != null && armor.getItem() instanceof ItemArmor && armor.isItemDamaged()) {
|
||||
int maxDamage = armor.getMaxDamage();
|
||||
int repairAmount = Math.max(1, (int)(maxDamage * 0.05));
|
||||
armor.setItemDamage(Math.max(0, armor.getItemDamage() - repairAmount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
|
||||
if (!player.worldObj.isRemote && count % 20 == 0) {
|
||||
player.worldObj.playSoundAtEntity(player, "random.anvil_use", 0.7F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,23 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
package com.zivilon.cinder_loe.items.specials;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import java.util.List;
|
||||
import lotr.common.LOTRCreativeTabs;
|
||||
|
||||
import lotr.common.LOTRLevelData;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.fac.LOTRFaction;
|
||||
import lotr.common.network.LOTRPacketHandler;
|
||||
import lotr.common.network.LOTRPacketWeaponFX;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.zivilon.cinder_loe.items.WizardStaff;
|
||||
@ -0,0 +1,85 @@
|
||||
package com.zivilon.cinder_loe.items;
|
||||
|
||||
import com.zivilon.cinder_loe.LoECreativeTabs;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class spiceIngredient extends Item {
|
||||
public IIcon[] icons;
|
||||
|
||||
public spiceIngredient() {
|
||||
this.setHasSubtypes(true);
|
||||
setMaxStackSize(64);
|
||||
this.setMaxDamage(0);
|
||||
setCreativeTab(LoECreativeTabs.tabMiscLoE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
if (damage < 0 || damage >= icons.length) {
|
||||
damage = 0;
|
||||
}
|
||||
return this.icons[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[12];
|
||||
this.icons[0] = iconRegister.registerIcon("lotr:fine_bone_dust");
|
||||
this.icons[1] = iconRegister.registerIcon("lotr:dried_morgul_caps");
|
||||
this.icons[2] = iconRegister.registerIcon("lotr:blighted_root");
|
||||
this.icons[3] = iconRegister.registerIcon("lotr:coldbreath_leaf");
|
||||
this.icons[4] = iconRegister.registerIcon("lotr:brambleberry");
|
||||
this.icons[5] = iconRegister.registerIcon("lotr:willow_bark");
|
||||
this.icons[6] = iconRegister.registerIcon("lotr:seregon");
|
||||
this.icons[7] = iconRegister.registerIcon("lotr:niphredil_seeds");
|
||||
this.icons[8] = iconRegister.registerIcon("lotr:dried_mallorn");
|
||||
this.icons[9] = iconRegister.registerIcon("lotr:curing_salts");
|
||||
this.icons[10] = iconRegister.registerIcon("lotr:underroot");
|
||||
this.icons[11] = iconRegister.registerIcon("lotr:miners_lichen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack item) {
|
||||
switch(item.getItemDamage()) {
|
||||
case 0:
|
||||
return "item.fine_bone_dust";
|
||||
case 1:
|
||||
return "item.dried_morgul_caps";
|
||||
case 2:
|
||||
return "item.blighted_root";
|
||||
case 3:
|
||||
return "item.coldbreath_leaf";
|
||||
case 4:
|
||||
return "item.brambleberry";
|
||||
case 5:
|
||||
return "item.willow_bark";
|
||||
case 6:
|
||||
return "item.seregon";
|
||||
case 7:
|
||||
return "item.niphredil_seeds";
|
||||
case 8:
|
||||
return "item.dried_mallorn";
|
||||
case 9:
|
||||
return "item.curing_salts";
|
||||
case 10:
|
||||
return "item.underroot";
|
||||
case 11:
|
||||
return "item.miners_lichen";
|
||||
default:
|
||||
return "item.fine_bone_dust";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.zivilon.cinder_loe.mixins;
|
||||
|
||||
import com.zivilon.cinder_loe.CinderLoE;
|
||||
import lotr.common.LOTRMod;
|
||||
import lotr.common.enchant.LOTREnchantment;
|
||||
import lotr.common.enchant.LOTREnchantmentHelper;
|
||||
import lotr.common.entity.npc.LOTREntityNPC;
|
||||
import lotr.common.entity.npc.LOTREntityOrc;
|
||||
import lotr.common.entity.npc.LOTREntityWarg;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
|
||||
@Mixin(LOTREntityOrc.class)
|
||||
public abstract class MixinLOTREntityOrc extends LOTREntityNPC {
|
||||
public boolean isWeakOrc = true;
|
||||
|
||||
public MixinLOTREntityOrc(World worldIn) {
|
||||
super(worldIn);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author KeyLime17
|
||||
* @reason Mevans
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public int getTotalArmorValue() {
|
||||
if (this.isWeakOrc) {
|
||||
return MathHelper.floor_double((double)((double)super.getTotalArmorValue() * 1));
|
||||
}
|
||||
return super.getTotalArmorValue();
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 588 B |
|
After Width: | Height: | Size: 418 B |
|
After Width: | Height: | Size: 419 B |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 412 B |
|
After Width: | Height: | Size: 440 B |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 529 B |
|
After Width: | Height: | Size: 385 B |
|
After Width: | Height: | Size: 542 B |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 858 B |
|
After Width: | Height: | Size: 442 B |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 579 B |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 594 B |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 525 B |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 527 B |
|
After Width: | Height: | Size: 731 B |
|
Before Width: | Height: | Size: 858 B After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 511 B |