Bug testing
parent
4d3fdf8298
commit
084c02a1bf
Binary file not shown.
@ -0,0 +1,25 @@
|
|||||||
|
package com.zivilon.cinder_loe.blocks;
|
||||||
|
|
||||||
|
import lotr.common.LOTRCreativeTabs;
|
||||||
|
import lotr.common.block.LOTRBlockBrick2;
|
||||||
|
import lotr.common.block.LOTRBlockBrickBase;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class CobbleBlock extends LOTRBlockBrickBase {
|
||||||
|
|
||||||
|
public CobbleBlock() {
|
||||||
|
/*
|
||||||
|
try {
|
||||||
|
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
|
||||||
|
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
|
||||||
|
setCreativeTab((CreativeTabs)tab);
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
this.setBrickNames("drystone", "mordor");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package com.zivilon.cinder_loe.blocks;
|
|
||||||
|
|
||||||
import com.zivilon.cinder_loe.util.Utilities;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import lotr.common.LOTRCreativeTabs;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class cobbleDrystone extends Block {
|
|
||||||
|
|
||||||
public cobbleDrystone() {
|
|
||||||
super(Material.rock); // Choose the appropriate material
|
|
||||||
try {
|
|
||||||
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to
|
|
||||||
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null);
|
|
||||||
setCreativeTab((CreativeTabs)tab);
|
|
||||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// Set other properties like hardness, resistance, name, etc.
|
|
||||||
setHardness(2.0F);
|
|
||||||
setResistance(5.0F);
|
|
||||||
setBlockTextureName(Utilities.toSnakeCase("lotr:cobble_drystone"));
|
|
||||||
setBlockName("lotr:cobbleDrystone");
|
|
||||||
// setCreativeTab((CreativeTabs) LOTRCreativeTabs.tabBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
|
||||||
this.blockIcon = iconRegister.registerIcon("lotr:cobbleDrystone");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
package com.zivilon.cinder_loe.blocks;
|
|
||||||
|
|
||||||
import com.zivilon.cinder_loe.util.Utilities;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import lotr.common.LOTRCreativeTabs;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
public class mordorcobble extends Block {
|
|
||||||
public mordorcobble() {
|
|
||||||
super(Material.rock);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock");
|
|
||||||
LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get((Object)null);
|
|
||||||
this.setCreativeTab(tab);
|
|
||||||
} catch (IllegalAccessException | NoSuchFieldException var3) {
|
|
||||||
ReflectiveOperationException e = var3;
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setHardness(2.0F);
|
|
||||||
this.setResistance(5.0F);
|
|
||||||
this.setBlockTextureName(Utilities.toSnakeCase("lotr:mordorcobble"));
|
|
||||||
this.setBlockName("lotr:mordorcobble");
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
|
||||||
this.blockIcon = iconRegister.registerIcon("lotr:mordorcobble");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
package com.zivilon.cinder_loe.mixins.overrides;
|
||||||
|
|
||||||
|
import lotr.common.LOTRAchievement;
|
||||||
|
import lotr.common.LOTRLevelData;
|
||||||
|
import lotr.common.block.LOTRBlockSaplingBase;
|
||||||
|
import lotr.common.entity.npc.LOTREntityDarkHuorn;
|
||||||
|
import lotr.common.entity.npc.LOTREntityHuorn;
|
||||||
|
import lotr.common.entity.npc.LOTREntityTree;
|
||||||
|
import lotr.common.entity.npc.LOTRHiredNPCInfo;
|
||||||
|
import lotr.common.fac.LOTRAlignmentValues;
|
||||||
|
import lotr.common.fac.LOTRFaction;
|
||||||
|
import lotr.common.item.LOTRItemEntDraught;
|
||||||
|
import lotr.common.item.LOTRItemPotion;
|
||||||
|
import lotr.common.item.LOTRPoisonedDrinks;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockSapling;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.*;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
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 java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
@Mixin(LOTRItemEntDraught.class)
|
||||||
|
public abstract class MixinLOTRItemEntDraught {
|
||||||
|
|
||||||
|
|
||||||
|
private LOTRItemEntDraught.DraughtInfo getDraughtInfo(ItemStack itemstack) {
|
||||||
|
int i = itemstack.getItemDamage();
|
||||||
|
if (i >= LOTRItemEntDraught.draughtTypes.length) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
return LOTRItemEntDraught.draughtTypes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author
|
||||||
|
* @reason
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public ItemStack onEaten(ItemStack itemstack, World world, EntityPlayer entityplayer) {
|
||||||
|
|
||||||
|
final Random rand = new Random();
|
||||||
|
int chance = rand.nextInt(100);
|
||||||
|
|
||||||
|
if (chance < 20) {
|
||||||
|
if (!world.isRemote) {
|
||||||
|
entityplayer.addPotionEffect(new PotionEffect(Potion.poison.id, 400));
|
||||||
|
ChatComponentText message = new ChatComponentText("As you drink, you taste the bitter tears of Yavanna's Shepherds...");
|
||||||
|
ChatStyle style = new ChatStyle();
|
||||||
|
style.setColor(EnumChatFormatting.RED); // Set color to red
|
||||||
|
message.setChatStyle(style);
|
||||||
|
entityplayer.addChatMessage(message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (entityplayer.canEat(false)) {
|
||||||
|
entityplayer.getFoodStats().addStats(this.getDraughtInfo((ItemStack)itemstack).heal, this.getDraughtInfo((ItemStack)itemstack).saturation);
|
||||||
|
}
|
||||||
|
if (!world.isRemote) {
|
||||||
|
List effects = this.getDraughtInfo((ItemStack)itemstack).effects;
|
||||||
|
for (int i = 0; i < effects.size(); ++i) {
|
||||||
|
PotionEffect effect = (PotionEffect)effects.get(i);
|
||||||
|
entityplayer.addPotionEffect(new PotionEffect(effect.getPotionID(), effect.getDuration()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!world.isRemote && entityplayer.getCurrentEquippedItem() == itemstack) {
|
||||||
|
LOTRLevelData.getData(entityplayer).addAchievement(LOTRAchievement.drinkEntDraught);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !entityplayer.capabilities.isCreativeMode ? new ItemStack(Items.bowl) : itemstack;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author
|
||||||
|
* @reason
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int side, float f, float f1, float f2) {
|
||||||
|
if (this.getDraughtInfo((ItemStack)itemstack).name.equals("gold")) {
|
||||||
|
if (LOTRLevelData.getData(entityplayer).getAlignment(LOTRFaction.FANGORN) < 500.0f) {
|
||||||
|
if (!world.isRemote) {
|
||||||
|
LOTRAlignmentValues.notifyAlignmentNotHighEnough(entityplayer, 500.0f, LOTRFaction.FANGORN);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Block block = world.getBlock(i, j, k);
|
||||||
|
int meta = world.getBlockMetadata(i, j, k);
|
||||||
|
if (block instanceof BlockSapling || block instanceof LOTRBlockSaplingBase) {
|
||||||
|
meta &= 7;
|
||||||
|
for (int huornType = 0; huornType < LOTREntityTree.TYPES.length; ++huornType) {
|
||||||
|
if (block != LOTREntityTree.SAPLING_BLOCKS[huornType] || meta != LOTREntityTree.SAPLING_META[huornType]) continue;
|
||||||
|
LOTREntityDarkHuorn darkhuorn = new LOTREntityDarkHuorn(world);
|
||||||
|
darkhuorn.setTreeType(huornType);
|
||||||
|
darkhuorn.isNPCPersistent = true;
|
||||||
|
darkhuorn.liftSpawnRestrictions = true;
|
||||||
|
darkhuorn.setLocationAndAngles((double)i + 0.5, j, (double)k + 0.5, 0.0f, 0.0f);
|
||||||
|
if (!darkhuorn.getCanSpawnHere()) continue;
|
||||||
|
if (!world.isRemote) {
|
||||||
|
world.spawnEntityInWorld((Entity)darkhuorn);
|
||||||
|
ChatComponentText message = new ChatComponentText("You have raised a Huorn.. However it cries for the deaths of its kin");
|
||||||
|
ChatStyle style = new ChatStyle();
|
||||||
|
style.setColor(EnumChatFormatting.RED); // Set color to red
|
||||||
|
message.setChatStyle(style);
|
||||||
|
entityplayer.addChatMessage(message);
|
||||||
|
LOTRLevelData.getData(entityplayer).addAchievement(LOTRAchievement.summonHuorn);
|
||||||
|
}
|
||||||
|
for (int l = 0; l < 24; ++l) {
|
||||||
|
double d = (double)i + 0.5 - world.rand.nextDouble() * 2.0 + world.rand.nextDouble() * 2.0;
|
||||||
|
double d1 = (double)j + world.rand.nextDouble() * 4.0;
|
||||||
|
double d2 = (double)k + 0.5 - world.rand.nextDouble() * 2.0 + world.rand.nextDouble() * 2.0;
|
||||||
|
world.spawnParticle("angryVillager", d, d1, d2, 0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
if (!entityplayer.capabilities.isCreativeMode) {
|
||||||
|
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, new ItemStack(Items.bowl));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Loading…
Reference in New Issue