diff --git a/src/main/java/com/zivilon/cinder_loe/CinderAchievement.java b/src/main/java/com/zivilon/cinder_loe/CinderAchievement.java new file mode 100644 index 0000000..d7ba2f0 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/CinderAchievement.java @@ -0,0 +1,17 @@ +package com.zivilon.cinder_loe; + +import lotr.common.LOTRAchievement; +import lotr.common.LOTRMod; +import net.minecraft.init.Items; + +public class CinderAchievement { + + public static LOTRAchievement tameMonkey; + public static LOTRAchievement pickOlog; + + public static void createAchievements() { + tameMonkey = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 78, LOTRMod.banana, "tameMonkey"); + pickOlog = new LOTRAchievement(LOTRAchievement.Category.GENERAL, 79, Items.skull, "pickpocketOlog"); + } + +} diff --git a/src/main/java/com/zivilon/cinder_loe/CinderDimension.java b/src/main/java/com/zivilon/cinder_loe/CinderDimension.java new file mode 100644 index 0000000..3f73fa1 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/CinderDimension.java @@ -0,0 +1,138 @@ +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 colorsToBiomeIDs = new HashMap(); + public List majorBiomes = new ArrayList(); + public List achievementCategories = new ArrayList(); + public List allAchievements = new ArrayList(); + public List factionList = new ArrayList(); + public List dimensionRegions = new ArrayList(); + public int spawnCap; + + private CinderDimension(String s, int i, Class c, boolean flag, int spawns, EnumSet 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 factionList = new ArrayList(); + + 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; + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index d89d1c8..3652b2d 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -9,6 +9,7 @@ import com.zivilon.cinder_loe.client.render.projectile.*; import com.zivilon.cinder_loe.command.CommandCinderCharacter; import com.zivilon.cinder_loe.command.CommandWarband; import com.zivilon.cinder_loe.entity.*; +import com.zivilon.cinder_loe.entity.animals.Monkey; import com.zivilon.cinder_loe.entity.corrupt.*; import com.zivilon.cinder_loe.entity.npc.*; import com.zivilon.cinder_loe.entity.npc.dwarf.RedDwarfArbalest; @@ -29,6 +30,7 @@ import com.zivilon.cinder_loe.network.*; import com.zivilon.cinder_loe.potion.LoEPotions; import com.zivilon.cinder_loe.tileentity.*; import com.zivilon.cinder_loe.util.Utilities; +import com.zivilon.cinder_loe.world.biome.CinderBiome; import com.zivilon.cinder_loe.world.event.*; import com.zivilon.cindercore.CinderCore; @@ -336,6 +338,7 @@ public class CinderLoE { FMLCommonHandler.instance().bus().register(new WarbandTickHandler()); MinecraftForge.EVENT_BUS.register(new SwiftnessHandler()); FMLCommonHandler.instance().bus().register(new com.zivilon.cinder_loe.world.event.UlukaiCurseHandler()); + CinderAchievement.createAchievements(); } @@ -362,7 +365,7 @@ public class CinderLoE { // event.registerServerCommand(new CommandMobileSound()); } - public void registerEntities() { // Last ID added: 60 + public void registerEntities() { // Last ID added: 63 ///GameRegistry.registerTileEntity(TileEntityMistBlock.class, "TileEntityMistBlock"); ///.registerBlock(TileEntityRustedSword, "TileEntityRustedSword"); @@ -400,6 +403,9 @@ public class CinderLoE { EntityRegistry.registerModEntity(SarumanWhiteFireball.class, "SarumanWhiteFireball", entityID + 61, this, 64, 10, true); EntityRegistry.registerModEntity(LOTREntitySauron.class, "LOTREntitySauron", (entityID + 28), this, 64, 1, true); EntityRegistry.registerModEntity(UtumnoSlaveTrader.class, "UtumnoSlaveTrader", (entityID + 30), this, 64, 1, true); + EntityRegistry.registerModEntity(Monkey.class, "Monkey", (entityID + 62), this, 64, 1, true); + + // Faction Units EntityRegistry.registerModEntity(RedDwarfWarrior.class, "RedDwarfWarrior", (entityID + 2), this, 64, 1, true); @@ -435,6 +441,7 @@ public class CinderLoE { EntityRegistry.registerModEntity(EsgarothSoldier.class, "EsgarothSoldier", (entityID + 56), this, 64, 1, true); EntityRegistry.registerModEntity(TauredainTrueBlood.class, "TauredainTrueBlood", (entityID + 57), this, 64, 1, true); EntityRegistry.registerModEntity(Sirrandrai.class, "Sirrandrai", (entityID + 58), this, 64, 1, true); + EntityRegistry.registerModEntity(UmbarUsurper.class, "Usurper", (entityID + 63), this, 64, 1, true); } @@ -1009,6 +1016,7 @@ public class CinderLoE { RenderingRegistry.registerEntityRenderingHandler(Renegade.class, new RenderRenegade()); RenderingRegistry.registerEntityRenderingHandler(RenegadeCaptain.class, new RenderRenegade()); RenderingRegistry.registerEntityRenderingHandler(Wraith.class, new RenderWraith()); + RenderingRegistry.registerEntityRenderingHandler(Monkey.class, new RenderMonkey()); RenderingRegistry.registerEntityRenderingHandler(RedDwarfWarrior.class, new LOTRRenderDwarf()); RenderingRegistry.registerEntityRenderingHandler(RedDwarfArbalest.class, new LOTRRenderDwarf()); diff --git a/src/main/java/com/zivilon/cinder_loe/client/render/RenderMonkey.java b/src/main/java/com/zivilon/cinder_loe/client/render/RenderMonkey.java new file mode 100644 index 0000000..85936e0 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/client/render/RenderMonkey.java @@ -0,0 +1,45 @@ +package com.zivilon.cinder_loe.client.render; + +import com.zivilon.cinder_loe.entity.Wraith; +import lotr.client.LOTRSpeechClient; +import lotr.client.model.LOTRModelGollum; +import lotr.client.model.LOTRModelMarshWraith; +import lotr.client.render.entity.LOTRNPCRendering; +import lotr.common.entity.npc.LOTREntityGollum; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +public class RenderMonkey extends RenderLiving { + private static ResourceLocation skin = new ResourceLocation("cinder_loe:mob/monkey.png"); + + public RenderMonkey() { + super((ModelBase) new LOTRModelGollum(), 0.5f); + } + + protected ResourceLocation getEntityTexture(Entity entity) { + return skin; + } + + protected void preRenderCallback(EntityLivingBase entity, float f) { + float scale = 0.85f; + GL11.glScalef((float) scale, (float) scale, (float) scale); + } + + public void doRender(EntityLiving entity, double d, double d1, double d2, float f, float f1) { + LOTREntityGollum gollum = (LOTREntityGollum)entity; + super.doRender((EntityLiving)gollum, d, d1, d2, f, f1); + if (Minecraft.isGuiEnabled()) { + if (gollum.getGollumOwner() == Minecraft.getMinecraft().thePlayer) { + LOTRNPCRendering.renderNPCHealthBar((EntityLivingBase)entity, d, d1 + 0.5, d2); + } + } + + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/command/CommandMobileSound.java b/src/main/java/com/zivilon/cinder_loe/command/CommandMobileSound.java new file mode 100644 index 0000000..46793b9 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/command/CommandMobileSound.java @@ -0,0 +1,43 @@ +package com.zivilon.cinder_loe.command; + +import com.zivilon.cinder_loe.world.sounds.MobileSoundHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.ChatComponentText; + +public class CommandMobileSound extends CommandBase { + + private boolean active = false; + + @Override + public String getCommandName() { + return "movesound"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/movesound - turns you into a walking jukebox (toggle command)"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + EntityPlayer player = getCommandSenderAsPlayer(sender); + + if (!player.worldObj.isRemote) { + return; + } + if (!active) { + Minecraft.getMinecraft().getSoundHandler().playSound(new MobileSoundHandler(player, "soundname")); + active = true; + player.addChatMessage(new ChatComponentText("You are a walking jukebox")); + } else { + active = false; + player.addChatMessage(new ChatComponentText("You are no longer a walking jukebox")); + } + + } + +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/MonkeyBananaAI.java b/src/main/java/com/zivilon/cinder_loe/entity/MonkeyBananaAI.java new file mode 100644 index 0000000..f5189ef --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/MonkeyBananaAI.java @@ -0,0 +1,139 @@ +package com.zivilon.cinder_loe.entity; + +import java.util.Random; + +import lotr.common.LOTRMod; +import lotr.common.entity.npc.LOTREntityGollum; +import lotr.common.entity.npc.LOTRSpeech; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class MonkeyBananaAI extends EntityAIBase { + private LOTREntityGollum theGollum; + private double moveSpeed; + private boolean avoidsWater; + private World theWorld; + private double xPosition; + private double yPosition; + private double zPosition; + private int moveTick; + private int fishTick; + private boolean finished; + + public MonkeyBananaAI(LOTREntityGollum entity, double d) { + this.theGollum = entity; + this.moveSpeed = d; + this.theWorld = entity.worldObj; + this.setMutexBits(3); + } + + public boolean shouldExecute() { + if (this.theGollum.getGollumOwner() == null) { + return false; + } + if (this.theGollum.isGollumSitting()) { + return false; + } + if (this.theGollum.prevFishTime > 0) { + return false; + } + if (this.theGollum.isFishing) { + return false; + } + if (this.theGollum.getEquipmentInSlot(0) != null) { + return false; + } + if (this.theGollum.getRNG().nextInt(60) == 0) { + Vec3 vec3 = this.findPossibleFishingLocation(); + if (vec3 == null) { + return false; + } + this.xPosition = vec3.xCoord; + this.yPosition = vec3.yCoord; + this.zPosition = vec3.zCoord; + return true; + } + return false; + } + + private Vec3 findPossibleFishingLocation() { + Random random = this.theGollum.getRNG(); + int range = 16; + for (int l = 0; l < 32; ++l) { + int x = MathHelper.floor_double((double)this.theGollum.posX) - range + random.nextInt(range * 2 + 1); + int y = MathHelper.floor_double((double)this.theGollum.boundingBox.minY) - 8 + random.nextInt(17); + int z = MathHelper.floor_double((double)this.theGollum.posZ) - range + random.nextInt(range * 2 + 1); + Block banana = theWorld.getBlock(x, y, z); + + if (banana == LOTRMod.bananaBlock) { + return Vec3.createVectorHelper(((double)x + 0.5), ((double)y + 0.5), (double)z + 0.5); + } + } + return null; + } + + public boolean continueExecuting() { + return this.theGollum.getGollumOwner() + != null && !this.theGollum.isGollumSitting() + && this.moveTick < 300 + && !this.finished; + } + + public void startExecuting() { + this.avoidsWater = this.theGollum.getNavigator().getAvoidsWater(); + this.theGollum.getNavigator().setAvoidsWater(false); + this.finished = false; + } + + public void resetTask() { + this.theGollum.getNavigator().clearPathEntity(); + this.theGollum.getNavigator().setAvoidsWater(this.avoidsWater); + this.moveTick = 0; + + this.fishTick = 0; + if (this.finished) { + this.finished = false; + this.theGollum.prevFishTime = 3000; + } else { + this.theGollum.prevFishTime = 600; + } + this.theGollum.isFishing = false; + } + + public void updateTask() { + if (theGollum.getDistance(xPosition, yPosition, zPosition) < 4.0) { + int x = MathHelper.floor_double((double)this.theGollum.posX); + int y = MathHelper.floor_double((double)this.theGollum.boundingBox.minY); + int z = MathHelper.floor_double((double)this.theGollum.posZ); + + if (theWorld.getBlock(x, y, z) == LOTRMod.bananaBlock) { + theWorld.setBlockToAir(x, y, z); + LOTRMod.bananaBlock.dropBlockAsItem(theWorld, x, y, z, theWorld.getBlockMetadata(x, y, z), 0); + + finished = true; + LOTRSpeech.sendSpeech(this.theGollum.getGollumOwner(), this.theGollum, LOTRSpeech.getRandomSpeechForPlayer(this.theGollum, "monkey/say", this.theGollum.getGollumOwner())); + } else { + theGollum.getNavigator().tryMoveToXYZ(xPosition, yPosition, zPosition, moveSpeed); + moveTick++; + } + } + } + + private boolean atFishingLocation() { + if (this.theGollum.getDistanceSq(this.xPosition, this.yPosition, this.zPosition) < 4.0) { + int k; + int j; + int i = MathHelper.floor_double((double)this.theGollum.posX); + return this.theWorld.getBlock(i, j = MathHelper.floor_double((double)this.theGollum.boundingBox.minY), k = MathHelper.floor_double((double)this.theGollum.posZ)).getMaterial() == Material.water || this.theWorld.getBlock(i, j - 1, k).getMaterial() == Material.water; + } + return false; + } +} + diff --git a/src/main/java/com/zivilon/cinder_loe/entity/SpeechBankModifier.java b/src/main/java/com/zivilon/cinder_loe/entity/SpeechBankModifier.java index 8fc5cc5..32217e8 100644 --- a/src/main/java/com/zivilon/cinder_loe/entity/SpeechBankModifier.java +++ b/src/main/java/com/zivilon/cinder_loe/entity/SpeechBankModifier.java @@ -80,6 +80,7 @@ public class SpeechBankModifier { speechBanks.put("corruptSpeak/all/neutral", loadSpeechLines("corruptSpeak/all/neutral")); speechBanks.put("corruptSpeak/all/hostile", loadSpeechLines("corruptSpeak/all/hostile")); speechBanks.put("corruptSpeak/all/skeleton", loadSpeechLines("corruptSpeak/all/skeleton")); + speechBanks.put("monkey/say", loadSpeechLines("monkey/say")); return speechBanks; } diff --git a/src/main/java/com/zivilon/cinder_loe/entity/animals/Monkey.java b/src/main/java/com/zivilon/cinder_loe/entity/animals/Monkey.java new file mode 100644 index 0000000..79dae6b --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/animals/Monkey.java @@ -0,0 +1,249 @@ +package com.zivilon.cinder_loe.entity.animals; + +import com.zivilon.cinder_loe.CinderAchievement; +import com.zivilon.cinder_loe.entity.MonkeyBananaAI; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import lotr.common.LOTRAchievement; +import lotr.common.LOTRLevelData; +import lotr.common.LOTRMod; +import lotr.common.entity.ai.*; +import lotr.common.entity.npc.LOTRCharacter; +import lotr.common.entity.npc.LOTREntityGollum; +import lotr.common.entity.npc.LOTREntityNPC; +import lotr.common.entity.npc.LOTRSpeech; +import lotr.common.inventory.LOTRInventoryNPC; +import net.minecraft.entity.*; +import net.minecraft.entity.ai.*; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.util.*; +import net.minecraft.world.World; + +import java.util.List; + +public class Monkey extends LOTREntityGollum { + + public static int INV_ROWS = 1; + private int eatingTick; + public int prevFishTime = 400; + public boolean isFishing; + public LOTRInventoryNPC inventory = new LOTRInventoryNPC("gollum", this, INV_ROWS * 9); + public int prevFishRequired; + public int fishRequired = this.prevFishRequired = 32; + + public Monkey(World world) { + super(world); + this.setSize(0.6f, 1.2f); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(0, (EntityAIBase)new EntityAISwimming((EntityLiving)this)); + this.tasks.addTask(1, (EntityAIBase)new LOTREntityAIGollumRemainStill(this)); + this.tasks.addTask(2, (EntityAIBase)new LOTREntityAIGollumPanic(this, 1.4)); + this.tasks.addTask(3, (EntityAIBase)new LOTREntityAIGollumAvoidEntity(this, LOTREntityNPC.class, 8.0f, 1.2, 1.4)); + this.tasks.addTask(4, (EntityAIBase)new MonkeyBananaAI(this, 1.5)); + this.tasks.addTask(5, (EntityAIBase)new LOTREntityAIGollumFollowOwner(this, 1.2, 6.0f, 4.0f)); + this.tasks.addTask(6, (EntityAIBase)new EntityAIWander((EntityCreature)this, 1.0)); + this.tasks.addTask(7, (EntityAIBase)new EntityAIWatchClosest((EntityLiving)this, EntityPlayer.class, 8.0f, 0.1f)); + this.tasks.addTask(8, (EntityAIBase)new EntityAILookIdle((EntityLiving)this)); + + } + + @Override + public void onLivingUpdate() { + double d; + super.onLivingUpdate(); + if (!this.worldObj.isRemote && this.rand.nextInt(500) == 0) { + this.heal(1.0f); + } + if (this.eatingTick > 0) { + if (this.eatingTick % 4 == 0) { + this.worldObj.playSoundAtEntity((Entity)this, "random.eat", 0.5f + 0.5f * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2f + 1.0f); + } + --this.eatingTick; + } + if (this.prevFishTime > 0) { + --this.prevFishTime; + } + if (this.isGollumSitting() && !this.worldObj.isRemote && this.onGround) { + this.getJumpHelper().setJumping(); + } + if (!this.worldObj.isRemote && this.getEquipmentInSlot(0) != null && this.getGollumOwner() != null && (d = this.getDistanceSqToEntity((Entity)this.getGollumOwner())) < 4.0) { + this.getLookHelper().setLookPositionWithEntity((Entity)this.getGollumOwner(), 100.0f, 100.0f); + this.getLookHelper().onUpdateLook(); + EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)this.getEyeHeight(), this.posZ, this.getEquipmentInSlot(0)); + entityitem.delayBeforeCanPickup = 40; + float f = 0.3f; + entityitem.motionX = -MathHelper.sin((float)(this.rotationYawHead / 180.0f * (float)Math.PI)) * MathHelper.cos((float)(this.rotationPitch / 180.0f * (float)Math.PI)) * f; + entityitem.motionZ = MathHelper.cos((float)(this.rotationYawHead / 180.0f * (float)Math.PI)) * MathHelper.cos((float)(this.rotationPitch / 180.0f * (float)Math.PI)) * f; + entityitem.motionY = -MathHelper.sin((float)(this.rotationPitch / 180.0f * (float)Math.PI)) * f + 0.1f; + f = 0.02f; + float f1 = this.rand.nextFloat() * (float)Math.PI * 2.0f; + entityitem.motionX += Math.cos(f1) * (double)(f *= this.rand.nextFloat()); + entityitem.motionY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1f); + entityitem.motionZ += Math.sin(f1) * (double)f; + this.worldObj.spawnEntityInWorld((Entity)entityitem); + this.setCurrentItemOrArmor(0, null); + } + if (!this.worldObj.isRemote && StringUtils.isNullOrEmpty((String)this.getGollumOwnerUUID()) && this.rand.nextInt(40) == 0) { + List nearbyPlayers = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(80.0, 80.0, 80.0)); + for (Object entityplayer : nearbyPlayers) { + double d2 = this.getDistanceToEntity((Entity)entityplayer); + int chance = (int)(d2 / 8.0); + if (this.rand.nextInt(chance = Math.max(2, chance)) != 0) continue; + this.worldObj.playSoundAtEntity((Entity)entityplayer, this.getLivingSound(), this.getSoundVolume(), this.getSoundPitch()); + } + } + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25); + } + + private boolean canGollumEat(ItemStack itemstack) { + if (itemstack.getItem() == LOTRMod.mango || itemstack.getItem() == LOTRMod.banana) { + return true; + } + ItemFood food = (ItemFood)itemstack.getItem(); + return food.isWolfsFavoriteMeat(); + } + + @Override + public boolean interact(EntityPlayer entityplayer) { + if (!this.worldObj.isRemote) { + if (this.getGollumOwner() != null && entityplayer == this.getGollumOwner()) { + ItemStack itemstack = entityplayer.inventory.getCurrentItem(); + if (itemstack != null && itemstack.getItem() instanceof ItemFood && this.canGollumEat(itemstack) && this.getHealth() < this.getMaxHealth()) { + if (!entityplayer.capabilities.isCreativeMode) { + --itemstack.stackSize; + if (itemstack.stackSize <= 0) { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); + } + } + this.heal(((ItemFood)itemstack.getItem()).func_150905_g(itemstack)); + this.eatingTick = 20; + return true; + } + if (entityplayer.isSneaking()) { + entityplayer.openGui((Object)LOTRMod.instance, 10, this.worldObj, this.getEntityId(), 0, 0); + return true; + } + this.setGollumSitting(!this.isGollumSitting()); + if (this.isGollumSitting()) { + LOTRSpeech.sendSpeech(this.getGollumOwner(), this, LOTRSpeech.getRandomSpeechForPlayer(this, "monkey/say", this.getGollumOwner())); + } else { + LOTRSpeech.sendSpeech(this.getGollumOwner(), this, LOTRSpeech.getRandomSpeechForPlayer(this, "monkey/say", this.getGollumOwner())); + } + return true; + } + ItemStack itemstack = entityplayer.inventory.getCurrentItem(); + if (itemstack != null && itemstack.getItem() == LOTRMod.banana) { + boolean tamed = false; + if (itemstack.stackSize >= this.fishRequired) { + if (!entityplayer.capabilities.isCreativeMode) { + itemstack.stackSize -= this.fishRequired; + if (itemstack.stackSize <= 0) { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); + } + } + this.fishRequired = 0; + } else { + this.fishRequired -= itemstack.stackSize; + if (!entityplayer.capabilities.isCreativeMode) { + entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null); + } + } + this.eatingTick = 20; + if (this.fishRequired <= 0) { + this.setGollumOwnerUUID(entityplayer.getUniqueID().toString()); + + LOTRLevelData.getData(entityplayer).addAchievement(CinderAchievement.tameMonkey); + LOTRSpeech.messageAllPlayers((IChatComponent)new ChatComponentTranslation("chat.lotr.tameMonkey", new Object[]{entityplayer.getCommandSenderName(), this.getCommandSenderName()})); + LOTRSpeech.sendSpeech(entityplayer, this, LOTRSpeech.getRandomSpeechForPlayer(this, "monkey/say", entityplayer)); + + this.spawnHearts(); + this.prevFishRequired = this.fishRequired = Math.round((float)this.prevFishRequired * (1.5f + this.rand.nextFloat() * 0.25f)); + } else { + LOTRSpeech.sendSpeech(entityplayer, this, LOTRSpeech.getRandomSpeechForPlayer(this, "monkey/say", entityplayer)); + } + return true; + } + } + return super.interact(entityplayer); + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + if (!this.isGollumFleeing()) { + return "monkey/say"; + } + return super.getSpeechBank(entityplayer); + } + + @Override + public void onDeath(DamageSource damagesource) { + if (!this.worldObj.isRemote && !StringUtils.isNullOrEmpty((String)this.getGollumOwnerUUID())) { + LOTRSpeech.messageAllPlayers(this.func_110142_aN().func_151521_b()); + } + super.onDeath(damagesource); + if (!this.worldObj.isRemote) { + this.inventory.dropAllItems(); + } + } + + public String getLivingSound() { + return "cinder_loe:monkey.idle"; + } + + public String getHurtSound() { + return "cinder_loe:monkey.hurt"; + } + + public String getDeathSound() { + return "cinder_loe:monkey.death"; + } + + public String getSplashSound() { + return "lotr:ent.mallorn.summonEnt"; + } + + @SideOnly(value= Side.CLIENT) + public void handleHealthUpdate(byte b) { + if (b == 15) { + for (int i = 0; i < 4; ++i) { + double d = this.rand.nextGaussian() * 0.02; + double d1 = this.rand.nextGaussian() * 0.02; + double d2 = this.rand.nextGaussian() * 0.02; + this.worldObj.spawnParticle(this.rand.nextBoolean() ? "bubble" : "splash", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0f) - (double)this.width, this.posY + 0.5 + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0f) - (double)this.width, d, d1, d2); + } + } else { + super.handleHealthUpdate(b); + } + } + + @Override + public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) { + + } + + @Override + public boolean attackEntityFrom(DamageSource damagesource, float f) { + EntityPlayer owner = this.getGollumOwner(); + if (owner != null && damagesource.getEntity() == owner) { + f = 0.0f; + if (!this.worldObj.isRemote) { + LOTRSpeech.sendSpeech(owner, this, LOTRSpeech.getRandomSpeechForPlayer(this, "monkey/say", owner)); + } + } + if (super.attackEntityFrom(damagesource, f)) { + this.setGollumSitting(false); + return true; + } + return false; + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/entity/npc/evil_human/UmbarUsurper.java b/src/main/java/com/zivilon/cinder_loe/entity/npc/evil_human/UmbarUsurper.java new file mode 100644 index 0000000..fe31917 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/entity/npc/evil_human/UmbarUsurper.java @@ -0,0 +1,64 @@ +package com.zivilon.cinder_loe.entity.npc.evil_human; + +import com.zivilon.cinder_loe.CinderLoE; +import lotr.common.LOTRMod; +import lotr.common.LOTRShields; +import lotr.common.entity.npc.LOTREntityAngmarHillmanWarrior; +import lotr.common.entity.npc.LOTREntityUmbarWarrior; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + + +public class UmbarUsurper extends LOTREntityUmbarWarrior { + + private static ItemStack[] weapons = new ItemStack[]{new ItemStack(LOTRMod.poleaxeNearHarad), new ItemStack(LOTRMod.scimitarNearHarad), new ItemStack(LOTRMod.polearmRhun)}; + private static ItemStack[] helmets = new ItemStack[]{new ItemStack(CinderLoE.helmetUsurper)}; + private static ItemStack[] bodies = new ItemStack[]{new ItemStack(CinderLoE.bodyUsurper)}; + private static ItemStack[] legs = new ItemStack[]{new ItemStack(CinderLoE.legsUsurper)}; + private static ItemStack[] boots = new ItemStack[]{new ItemStack(CinderLoE.bootsUsurper)}; + + public UmbarUsurper(World world) { + super(world); + this.npcShield = LOTRShields.ALIGNMENT_UMBAR; + } + + @Override + public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) { + data = super.onSpawnWithEgg(data); + int i = this.rand.nextInt(weapons.length); + this.npcItemsInv.setMeleeWeapon(weapons[i].copy()); + this.npcItemsInv.setIdleItem(this.npcItemsInv.getMeleeWeapon()); + i = this.rand.nextInt(boots.length); + this.setCurrentItemOrArmor(1, boots[i].copy()); + i = this.rand.nextInt(legs.length); + this.setCurrentItemOrArmor(2, legs[i].copy()); + i = this.rand.nextInt(bodies.length); + this.setCurrentItemOrArmor(3, bodies[i].copy()); + if (this.rand.nextInt(5) != 0) { + i = this.rand.nextInt(helmets.length); + this.setCurrentItemOrArmor(4, helmets[i].copy()); + } + return data; + } + + @Override + public String getSpeechBank(EntityPlayer entityplayer) { + if (this.isFriendlyAndAligned(entityplayer)) { + if (this.hiredNPCInfo.getHiringPlayer() == entityplayer) { + return "nearHarad/umbar/warrior/hired"; + } + return "nearHarad/umbar/warrior/friendly"; + } + return "nearHarad/umbar/warrior/hostile"; + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.2); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java index 6008768..88f9530 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/MixinLOTREntityNPC.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.mixins; +import com.zivilon.cinder_loe.CinderAchievement; import com.zivilon.cinder_loe.droptables.DropTable; import com.zivilon.cinder_loe.droptables.DropContext; import com.zivilon.cinder_loe.util.ILootableEntity; @@ -7,12 +8,17 @@ import com.zivilon.cinder_loe.util.IMixinEntityPlayer; import com.zivilon.cinder_loe.util.PickpocketUtils; import com.zivilon.cinder_loe.CinderLoE; +import lotr.common.LOTRLevelData; +import lotr.common.entity.npc.LOTREntityOlogHai; +import lotr.common.entity.npc.LOTRSpeech; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.*; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.IChatComponent; import net.minecraft.world.World; import lotr.common.entity.npc.LOTREntityNPC; @@ -42,6 +48,10 @@ public abstract class MixinLOTREntityNPC extends EntityCreature implements ILoot super(world); } + /** + * @author + * @reason + */ @Overwrite public boolean interact(EntityPlayer entityplayer) { if (PickpocketUtils.can_pickpocket(entityplayer, (LOTREntityNPC)(Object)this)) { @@ -50,6 +60,9 @@ public abstract class MixinLOTREntityNPC extends EntityCreature implements ILoot if (success) { List drops = DropTable.generate_drops((LOTREntityNPC)(Object)this, new DropContext[]{DropContext.PICKPOCKET}, 0); ItemStack item = drops.get(DropTable.random.nextInt(drops.size())); + if ((LOTREntityNPC)(Object)this instanceof LOTREntityOlogHai) { + + } if (entityplayer.inventory.addItemStackToInventory(item)) { last_pickpocket = (int)(System.currentTimeMillis() / 1000L); } else { @@ -57,6 +70,7 @@ public abstract class MixinLOTREntityNPC extends EntityCreature implements ILoot } else { last_pickpocket = (int)(System.currentTimeMillis() / 1000L); ((LOTREntityNPC)(Object)this).setRevengeTarget(entityplayer); + LOTRLevelData.getData(entityplayer).addAchievement(CinderAchievement.pickOlog); } return true; } diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRBiome.java b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRBiome.java new file mode 100644 index 0000000..113bfd9 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRBiome.java @@ -0,0 +1,20 @@ +package com.zivilon.cinder_loe.mixins.overrides; + +import com.zivilon.cinder_loe.world.biome.CinderBiome; +import com.zivilon.cinder_loe.world.biome.GenMistyForest; +import lotr.common.world.biome.LOTRBiome; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(LOTRBiome.class) +public class MixinLOTRBiome { +//public static void initBiomes() { + // + @Inject(method = "initBiomes", at = @At("TAIL"), remap = false) + private static void cinder_biome_init(CallbackInfo ci) { + CinderBiome.mistyforest = new GenMistyForest(171, true).setTemperatureRainfall(1.2f, 1.2f).setMinMaxHeight(0.7f, 0.4f).setColor(3168544).setBiomeName("mistyForest"); + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java index a994822..0cf1491 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRTradeEntriesOverrides.java @@ -133,6 +133,26 @@ public abstract class MixinLOTRTradeEntriesOverrides { */ @Inject(method = "setupTrades1", at = @At("RETURN"), remap = false) private static void newTrades(CallbackInfo ci) { + + DWARF_MINER_SELL = new LOTRTradeEntries(TradeType.SELL, + new LOTRTradeEntry(new ItemStack(Items.cooked_beef), 3), + new LOTRTradeEntry(new ItemStack(Items.cooked_porkchop), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.muttonCooked), 3), + new LOTRTradeEntry(new ItemStack(Items.cooked_chicken), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.gammon), 3), + new LOTRTradeEntry(new ItemStack(Items.cooked_fished), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.rabbitCooked), 3), + new LOTRTradeEntry(new ItemStack(LOTRMod.deerCooked), 3), + new LOTRTradeEntry(new ItemStack(Items.bread), 2), + new LOTRTradeEntry(new ItemStack(LOTRMod.cram), 6), + new LOTRTradeEntry(new ItemStack(LOTRMod.mugAle, 1, Short.MAX_VALUE), 8), + new LOTRTradeEntry(new ItemStack(LOTRMod.mugMead, 1, Short.MAX_VALUE), 8), + new LOTRTradeEntry(new ItemStack(LOTRMod.mugCider, 1, Short.MAX_VALUE), 8), + new LOTRTradeEntry(new ItemStack(LOTRMod.mugPerry, 1, Short.MAX_VALUE), 8), + new LOTRTradeEntry(new ItemStack(LOTRMod.mugDwarvenAle, 1, Short.MAX_VALUE), 12), + new LOTRTradeEntry(new ItemStack(LOTRMod.pickaxeDwarven), 10)); + + MORDOR_TRADER_BUY = new LOTRTradeEntries(TradeType.BUY, new LOTRTradeEntry(new ItemStack(LOTRMod.morgulTable), 100), new LOTRTradeEntry(new ItemStack(LOTRMod.helmetOrc), 20), diff --git a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java index 5070c85..700f333 100644 --- a/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java +++ b/src/main/java/com/zivilon/cinder_loe/mixins/overrides/MixinLOTRUnitTradeEntries.java @@ -4,6 +4,7 @@ import com.zivilon.cinder_loe.CinderUnitTradeEntry; import com.zivilon.cinder_loe.entity.npc.HobbitBannerBearer; import com.zivilon.cinder_loe.entity.npc.elf.Sirrandrai; import com.zivilon.cinder_loe.entity.npc.evil_human.RhudaurSoldier; +import com.zivilon.cinder_loe.entity.npc.evil_human.UmbarUsurper; import com.zivilon.cinder_loe.entity.npc.good_human.BattleNun; import com.zivilon.cinder_loe.entity.npc.good_human.EsgarothSoldier; import com.zivilon.cinder_loe.entity.npc.good_human.TauredainTrueBlood; @@ -12,9 +13,12 @@ import com.zivilon.cinder_loe.entity.npc.orc.NorthernOrc; import lotr.common.LOTRMod; import lotr.common.entity.animal.*; import lotr.common.entity.npc.*; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; @Mixin(LOTRUnitTradeEntries.class) public class MixinLOTRUnitTradeEntries { @@ -131,6 +135,18 @@ public class MixinLOTRUnitTradeEntries { new LOTRUnitTradeEntry(LOTREntityMordorOrcArcher.class, LOTREntityMordorSpider.class, "MordorOrcArcher_Spider", 250, 100.0f).setPledgeExclusive(), new LOTRUnitTradeEntry(LOTREntityNanUngolBannerBearer.class, 150, 150.0f), new LOTRUnitTradeEntry(LOTREntityNanUngolBannerBearer.class, LOTREntityMordorSpider.class, "MordorOrcArcher_Spider", 250, 250.0f).setPledgeExclusive()); +// @Unique +// +// //Lets give Gundies a chance to spawn with warg armor +// private static Item randomWargArmor() { +// Item[] options = { +// LOTRMod.wargArmorMordor, +// LOTRMod.wargArmorUruk, +// LOTRMod.wargArmorAngmar +// }; +// return options[LOTRMod.proxy.getClientWorld().rand.nextInt(options.length)]; +// } + @Shadow public static LOTRUnitTradeEntries GUNDABAD_ORC_MERCENARY_CAPTAIN = new LOTRUnitTradeEntries(100.0f, new LOTRUnitTradeEntry(LOTREntityGundabadOrc.class, 100, 0.0f), @@ -334,7 +350,8 @@ public class MixinLOTRUnitTradeEntries { new LOTRUnitTradeEntry(LOTREntityUmbarArcher.class, 250, 50.0f), new LOTRUnitTradeEntry(LOTREntityUmbarWarrior.class, LOTREntityHorse.class, "UmbarWarrior_Horse", 350, 100.0f).setMountArmor(LOTRMod.horseArmorUmbar).setPledgeExclusive(), new LOTRUnitTradeEntry(LOTREntityUmbarBannerBearer.class, 250, 150.0f), - new LOTRUnitTradeEntry(LOTREntityUmbarBannerBearer.class, LOTREntityHorse.class, "Banner_Horse", 350, 250.0f).setMountArmor(LOTRMod.horseArmorUmbar).setPledgeExclusive()); + new LOTRUnitTradeEntry(LOTREntityUmbarBannerBearer.class, LOTREntityHorse.class, "Banner_Horse", 350, 250.0f).setMountArmor(LOTRMod.horseArmorUmbar).setPledgeExclusive(), + new LOTRUnitTradeEntry(UmbarUsurper.class, 400, 500.0f).setPledgeExclusive()); @Shadow public static LOTRUnitTradeEntries CORSAIR_CAPTAIN = new LOTRUnitTradeEntries(150.0f, new LOTRUnitTradeEntry(LOTREntityCorsair.class, 200, 0.0f).setExtraInfo("Corsair")); diff --git a/src/main/java/com/zivilon/cinder_loe/world/CinderWorldProviderIsland.java b/src/main/java/com/zivilon/cinder_loe/world/CinderWorldProviderIsland.java new file mode 100644 index 0000000..13101cb --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/world/CinderWorldProviderIsland.java @@ -0,0 +1,39 @@ +package com.zivilon.cinder_loe.world; + +import com.zivilon.cinder_loe.CinderDimension; +import lotr.common.LOTRDimension; +import lotr.common.LOTRLevelData; +import lotr.common.world.LOTRChunkProvider; +import lotr.common.world.LOTRWorldProvider; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.chunk.IChunkProvider; + +public class CinderWorldProviderIsland extends LOTRWorldProvider { + + + + public IChunkProvider createChunkGenerator() { + return new LOTRChunkProvider(this.worldObj, this.worldObj.getSeed()); + } + + @Override + public String getDimensionName() { + return ""; + } + + public ChunkCoordinates getSpawnPoint() { + return new ChunkCoordinates(LOTRLevelData.middleEarthPortalX, LOTRLevelData.middleEarthPortalY, LOTRLevelData.middleEarthPortalZ); + } + + public void setSpawnPoint(int i, int j, int k) { + } + + public void setRingPortalLocation(int i, int j, int k) { + LOTRLevelData.markMiddleEarthPortalLocation(i, j, k); + } + + @Override + public LOTRDimension getLOTRDimension() { + return CinderDimension.ISLAND; + } +} \ No newline at end of file diff --git a/src/main/java/com/zivilon/cinder_loe/world/biome/CinderBiome.java b/src/main/java/com/zivilon/cinder_loe/world/biome/CinderBiome.java new file mode 100644 index 0000000..3657ce5 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/world/biome/CinderBiome.java @@ -0,0 +1,57 @@ +package com.zivilon.cinder_loe.world.biome; + +import lotr.common.LOTRDimension; +import lotr.common.entity.animal.*; +import lotr.common.world.biome.LOTRBiome; +import lotr.common.world.biome.LOTRBiomeDecorator; +import lotr.common.world.biome.LOTRMusicRegion; +import lotr.common.world.spawning.LOTREventSpawner; +import net.minecraft.entity.passive.*; +import net.minecraft.world.biome.BiomeGenBase; + +public abstract class CinderBiome extends LOTRBiome { + public static LOTRBiome mistyforest; + + public CinderBiome(int i, boolean major) { + super(i, major, LOTRDimension.MIDDLE_EARTH); + } + + public CinderBiome(int i, boolean major, LOTRDimension dim) { + super(i, false); + this.biomeDimension = dim; + if (this.biomeDimension.biomeList[i] != null) { + throw new IllegalArgumentException("LOTR biome already exists at index " + i + " for dimension " + this.biomeDimension.dimensionName + "!"); + } + this.biomeDimension.biomeList[i] = this; + if (major) { + this.biomeDimension.majorBiomes.add(this); + } + this.decorator = new LOTRBiomeDecorator(this); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableMonsterList.clear(); + this.spawnableCaveCreatureList.clear(); + if (this.hasDomesticAnimals()) { + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 10, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 10, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 8, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityDeer.class, 5, 4, 4)); + } else { + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityWildBoar.class, 10, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 8, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityDeer.class, 10, 4, 4)); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityAurochs.class, 6, 4, 4)); + } + this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityFish.class, 10, 4, 4)); + this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityButterfly.class, 8, 4, 4)); + this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityRabbit.class, 8, 4, 4)); + this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityBird.class, 10, 4, 4)); + this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + this.setBanditChance(LOTREventSpawner.EventChance.NEVER); + } + + @Override + public abstract LOTRMusicRegion.Sub getBiomeMusic(); +} diff --git a/src/main/java/com/zivilon/cinder_loe/world/biome/GenMistyForest.java b/src/main/java/com/zivilon/cinder_loe/world/biome/GenMistyForest.java new file mode 100644 index 0000000..a759a80 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/world/biome/GenMistyForest.java @@ -0,0 +1,94 @@ +package com.zivilon.cinder_loe.world.biome; + +import com.zivilon.cinder_loe.entity.animals.Monkey; +import lotr.common.entity.animal.*; +import lotr.common.world.LOTRWorldChunkManager; +import lotr.common.world.biome.LOTRBiomeGenFarHaradCloudForest; +import lotr.common.world.biome.LOTRMusicRegion; +import lotr.common.world.biome.variant.LOTRBiomeVariant; +import lotr.common.world.feature.LOTRTreeType; +import lotr.common.world.feature.LOTRWorldGenDoubleFlower; +import lotr.common.world.map.LOTRWaypoint; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenerator; + +import java.util.Random; + +public class GenMistyForest extends CinderBiome { + + public GenMistyForest(int i, boolean major) { + super(i, major); + this.spawnableCreatureList.clear(); + this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(LOTREntityFlamingo.class, 10, 4, 4)); + this.spawnableLOTRAmbientList.clear(); + this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityBird.class, 10, 4, 4)); + this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityButterfly.class, 10, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(LOTREntityJungleScorpion.class, 30, 4, 4)); + this.spawnableLOTRAmbientList.add(new BiomeGenBase.SpawnListEntry(LOTREntityWhiteOryx.class, 10, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(Monkey.class, 1, 4, 4)); + this.addBiomeVariantSet(LOTRBiomeVariant.SET_FOREST); + this.decorator.treesPerChunk = 10; + this.decorator.vinesPerChunk = 50; + this.decorator.flowersPerChunk = 4; + this.decorator.doubleFlowersPerChunk = 4; + this.decorator.grassPerChunk = 15; + this.decorator.doubleGrassPerChunk = 10; + this.decorator.enableFern = true; + this.decorator.melonPerChunk = 0.1f; + this.decorator.clearTrees(); + this.decorator.addTree(LOTRTreeType.JUNGLE_CLOUD, 4000); + this.decorator.addTree(LOTRTreeType.JUNGLE, 500); + this.decorator.addTree(LOTRTreeType.JUNGLE_SHRUB, 1000); + this.decorator.addTree(LOTRTreeType.MANGO, 20); + this.decorator.addTree(LOTRTreeType.BANANA, 20); + this.registerJungleFlowers(); + this.biomeColors.setGrass(2007124); + this.biomeColors.setFoliage(428338); + this.biomeColors.setSky(11452859); + this.biomeColors.setFoggy(true); + } + + @Override + public LOTRWaypoint.Region getBiomeWaypoints() { + return null; + } + + @Override + public LOTRMusicRegion.Sub getBiomeMusic() { + return LOTRMusicRegion.FAR_HARAD_JUNGLE.getSubregion("cloudForest"); + } + + @Override + public float getChanceToSpawnAnimals() { + return super.getChanceToSpawnAnimals() * 0.5f; + } + + @Override + public WorldGenerator getRandomWorldGenForDoubleFlower(Random random) { + LOTRWorldGenDoubleFlower doubleFlowerGen = new LOTRWorldGenDoubleFlower(); + if (random.nextInt(5) == 0) { + doubleFlowerGen.setFlowerType(3); + } else { + doubleFlowerGen.setFlowerType(2); + } + return doubleFlowerGen; + } + + @Override + public void decorate(World world, Random random, int i, int k) { + super.decorate(world, random, i, k); + LOTRBiomeVariant variant = ((LOTRWorldChunkManager)world.getWorldChunkManager()).getBiomeVariantAt(i + 8, k + 8); + if (variant == LOTRBiomeVariant.RIVER && random.nextInt(3) == 0) { + WorldGenAbstractTree bananaTree = LOTRTreeType.BANANA.create(false, random); + int bananas = 3 + random.nextInt(8); + for (int l = 0; l < bananas; ++l) { + int i1 = i + random.nextInt(16) + 8; + int k1 = k + random.nextInt(16) + 8; + int j1 = world.getTopSolidOrLiquidBlock(i1, k1); + bananaTree.generate(world, random, i1, j1, k1); + } + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/world/sounds/MobileSoundHandler.java b/src/main/java/com/zivilon/cinder_loe/world/sounds/MobileSoundHandler.java new file mode 100644 index 0000000..887299e --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/world/sounds/MobileSoundHandler.java @@ -0,0 +1,61 @@ +package com.zivilon.cinder_loe.world.sounds; + +import net.minecraft.client.audio.ISound; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.util.ResourceLocation; + +public class MobileSoundHandler implements ISound { + private final EntityPlayer player; + private final ResourceLocation soundLocation; + + public MobileSoundHandler(EntityPlayer player, String soundName) { + this.player = player; + this.soundLocation = new ResourceLocation("cinder_loe", soundName); + } + + @Override + public ResourceLocation getPositionedSoundLocation() { + return this.soundLocation; + } + + @Override + public float getVolume() { + return 1.0F; + } + + @Override + public float getPitch() { + return 1.0F; + } + + + @Override + public float getXPosF() { + return (float) player.posX; + } + @Override + public float getYPosF() { + return (float) player.posY; + } + + @Override + public float getZPosF() { + return (float) player.posZ; + } + + @Override + public boolean canRepeat() { + return true; + } + + @Override + public int getRepeatDelay() { + return 0; + } + + @Override + public ISound.AttenuationType getAttenuationType() { + return ISound.AttenuationType.LINEAR; + } +} diff --git a/src/main/resources/assets/cinder_loe/lang/en_US.lang b/src/main/resources/assets/cinder_loe/lang/en_US.lang index 74f2695..0faae93 100644 --- a/src/main/resources/assets/cinder_loe/lang/en_US.lang +++ b/src/main/resources/assets/cinder_loe/lang/en_US.lang @@ -334,6 +334,8 @@ entity.cinder_loe.RhudaurSoldier.name=Rhudaur Soldier entity.cinder_loe.TauredainTrueBlood.name=Taurethrim True-Blood entity.cinder_loe.Sirrandrai.name=Rider of Sirrandrai entity.cinder_loe.NorthernOrc.name=Northern Orc +entity.cinder_loe.Monkey.name=Monkey +entity.cinder_loe.Usurper.name=Umbar Usurper lotr.enchant.protectWeak1=Dented lotr.enchant.protectWeak2=Defective @@ -392,3 +394,12 @@ item.lotr:mugHumanBrew.name=Athelas Tea item.lotr:mugDwarfBrew.name=Dwarven Stout potion.overdose=Overdose + +#Achievements +lotr.achievement.tameMonkey.title=Monkey Business +lotr.achievement.tameMonkey.desc=Tame a Monkey +lotr.achievement.pickpocketOlog.title=Minor Mistake +lotr.achievement.pickpocketOlog.desc=Attempt and Fail to pickpocket an Olog-Hai + +#Biomes +lotr.biome.mistyForest.name=Misty Forest diff --git a/src/main/resources/assets/cinder_loe/mob/monkey.png b/src/main/resources/assets/cinder_loe/mob/monkey.png new file mode 100644 index 0000000..0878756 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/mob/monkey.png differ diff --git a/src/main/resources/assets/cinder_loe/sounds.json b/src/main/resources/assets/cinder_loe/sounds.json index 92c1501..3663352 100644 --- a/src/main/resources/assets/cinder_loe/sounds.json +++ b/src/main/resources/assets/cinder_loe/sounds.json @@ -30,5 +30,32 @@ [ "boss/spiders" ] + }, + "monkey.death": + { + "category": "neutral", + "sounds": + [ + "monkey/death" + ] + }, + "monkey.idle": + { + "category": "neutral", + "sounds": + [ + "monkey/idle1", + "monkey/idle2", + "monkey/idle3" + ] + }, + "monkey.hurt": + { + "category": "neutral", + "sounds": + [ + "monkey/hurt1", + "monkey/hurt2" + ] } } diff --git a/src/main/resources/assets/cinder_loe/sounds/monkey/death.ogg b/src/main/resources/assets/cinder_loe/sounds/monkey/death.ogg new file mode 100644 index 0000000..0f0140a Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/monkey/death.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/monkey/hurt1.ogg b/src/main/resources/assets/cinder_loe/sounds/monkey/hurt1.ogg new file mode 100644 index 0000000..a0fe841 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/monkey/hurt1.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/monkey/hurt2.ogg b/src/main/resources/assets/cinder_loe/sounds/monkey/hurt2.ogg new file mode 100644 index 0000000..c641f2e Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/monkey/hurt2.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/monkey/idle1.ogg b/src/main/resources/assets/cinder_loe/sounds/monkey/idle1.ogg new file mode 100644 index 0000000..b5fbc1a Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/monkey/idle1.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/monkey/idle2.ogg b/src/main/resources/assets/cinder_loe/sounds/monkey/idle2.ogg new file mode 100644 index 0000000..e9bdb42 Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/monkey/idle2.ogg differ diff --git a/src/main/resources/assets/cinder_loe/sounds/monkey/idle3.ogg b/src/main/resources/assets/cinder_loe/sounds/monkey/idle3.ogg new file mode 100644 index 0000000..07cc1be Binary files /dev/null and b/src/main/resources/assets/cinder_loe/sounds/monkey/idle3.ogg differ diff --git a/src/main/resources/assets/cinder_loe/speech/monkey/say.txt b/src/main/resources/assets/cinder_loe/speech/monkey/say.txt new file mode 100644 index 0000000..043034f --- /dev/null +++ b/src/main/resources/assets/cinder_loe/speech/monkey/say.txt @@ -0,0 +1,6 @@ +OAAAAAAAAAAAAAO OAAOAOAOAO OAOAOOAOO +OOOOA OAAOAOAOAO OAAOAOAOAO +AOAOAOAOAOAOAOAOOOOO OAOOAAOOAOAOOA +OAOAOOAO +OOOOA OAAOAOAOAO +OOAOAOAOAO \ No newline at end of file diff --git a/src/main/resources/mixins.cinder_loe.json b/src/main/resources/mixins.cinder_loe.json index 2a39c17..b7787c5 100644 --- a/src/main/resources/mixins.cinder_loe.json +++ b/src/main/resources/mixins.cinder_loe.json @@ -46,6 +46,7 @@ "overrides.MixinLOTRReplacedMethods", "overrides.MixinLOTRTradeEntriesOverrides", "overrides.MixinLOTRUnitTradeEntries", + "overrides.MixinLOTRBiome", "MixinEntityLivingBase", "MixinEntityPlayer", "MixinLOTREntityAIAttackOnCollide",