mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Might burn down ur house (#868)
* Various generics/deprecation shit this might all catch on fire, honestly, but it shouldn't, unless someone was using the wrong I18n in the wrong place in the first place... * uncrash the server depending on where else big dad used the bad I18n this might also still be crashy crash
This commit is contained in:
parent
d5902dee86
commit
912539e81d
42 changed files with 127 additions and 108 deletions
|
@ -23,13 +23,9 @@ if(hasProperty('buildnumber')){
|
|||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12-14.21.1.2400"
|
||||
version = "1.12-14.21.1.2426"
|
||||
runDir = "idea"
|
||||
|
||||
mappings = "snapshot_20170706"
|
||||
makeObfSourceJar = false
|
||||
//useDepAts = true
|
||||
|
||||
mappings = "snapshot_20170625"
|
||||
replaceIn "ModUtil.java"
|
||||
replace "@VERSION@", project.version.toString()
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
|||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
|
@ -34,6 +35,7 @@ import net.minecraft.util.NonNullList;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
@ -43,7 +45,7 @@ import java.util.Random;
|
|||
public class BlockColoredLamp extends BlockBase{
|
||||
|
||||
public static final TheColoredLampColors[] ALL_LAMP_TYPES = TheColoredLampColors.values();
|
||||
private static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
|
||||
public static final PropertyEnum<TheColoredLampColors> TYPE = PropertyEnum.create("type", TheColoredLampColors.class);
|
||||
public final boolean isOn;
|
||||
|
||||
public BlockColoredLamp(boolean isOn, String name){
|
||||
|
@ -157,7 +159,8 @@ public class BlockColoredLamp extends BlockBase{
|
|||
if(stack.getItemDamage() >= ALL_LAMP_TYPES.length){
|
||||
return StringUtil.BUGGED_ITEM_NAME;
|
||||
}
|
||||
return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".onSuffix.desc")+")" : "");
|
||||
if(Util.isClient()) return super.getItemStackDisplayName(stack)+(((BlockColoredLamp)this.block).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID+".onSuffix.desc")+")" : "");
|
||||
else return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class BlockCrystal extends BlockBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList list){
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
for(int j = 0; j < ALL_CRYSTALS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
|
|||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputterAdvanced;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -104,6 +105,7 @@ public class BlockInputter extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack){
|
||||
if(Util.isClient()) {
|
||||
long sysTime = System.currentTimeMillis();
|
||||
|
||||
if(this.lastSysTime+5000 < sysTime){
|
||||
|
@ -113,5 +115,7 @@ public class BlockInputter extends BlockContainerBase{
|
|||
|
||||
return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ModUtil.MOD_ID+".block_inputter.add."+this.toPick+".name")+")";
|
||||
}
|
||||
else return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
public class BlockMisc extends BlockBase{
|
||||
|
||||
public static final TheMiscBlocks[] ALL_MISC_BLOCKS = TheMiscBlocks.values();
|
||||
private static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
|
||||
public static final PropertyEnum<TheMiscBlocks> TYPE = PropertyEnum.create("type", TheMiscBlocks.class);
|
||||
|
||||
public BlockMisc(String name){
|
||||
super(Material.ROCK, name);
|
||||
|
@ -46,7 +46,7 @@ public class BlockMisc extends BlockBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList list){
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
for(int j = 0; j < ALL_MISC_BLOCKS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
|
|
|
@ -36,8 +36,6 @@ import java.util.Random;
|
|||
|
||||
public class BlockOilGenerator extends BlockContainerBase{
|
||||
|
||||
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
|
||||
|
||||
public BlockOilGenerator(String name){
|
||||
super(Material.ROCK, name);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
|
@ -77,7 +75,6 @@ public class BlockOilGenerator extends BlockContainerBase{
|
|||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9){
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if(!world.isRemote){
|
||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos);
|
||||
if(generator != null){
|
||||
|
|
|
@ -65,7 +65,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{
|
|||
return ((TileEntityPhantomRedstoneface)tile).providesWeak[side.ordinal()];
|
||||
}
|
||||
}
|
||||
return super.getWeakPower(state, world, pos, side);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BlockSlabs extends BlockBase{
|
|||
}
|
||||
|
||||
public BlockSlabs(String name, Block fullBlock, int meta){
|
||||
super(fullBlock.getMaterial(fullBlock.getDefaultState()), name);
|
||||
super(fullBlock.getDefaultState().getMaterial(), name);
|
||||
this.setHardness(1.5F);
|
||||
this.setResistance(10.0F);
|
||||
this.fullBlock = fullBlock;
|
||||
|
|
|
@ -41,7 +41,7 @@ public class BlockWallAA extends BlockBase{
|
|||
|
||||
|
||||
public BlockWallAA(String name, Block base, int meta){
|
||||
super(base.getMaterial(base.getDefaultState()), name);
|
||||
super(base.getDefaultState().getMaterial(), name);
|
||||
this.meta = meta;
|
||||
|
||||
this.setHardness(1.5F);
|
||||
|
@ -123,14 +123,14 @@ public class BlockWallAA extends BlockBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList list){
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
list.add(new ItemStack(this, 1, 0));
|
||||
}
|
||||
|
||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){
|
||||
IBlockState state = worldIn.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.GOURD));
|
||||
return block != Blocks.BARRIER && (!(block != this && !(block instanceof BlockFenceGate)) || ((state.getMaterial().isOpaque() && block.isFullCube(state)) && state.getMaterial() != Material.GOURD));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.List;
|
|||
public class BlockWildPlant extends BlockBushBase{
|
||||
|
||||
public static final TheWildPlants[] ALL_WILD_PLANTS = TheWildPlants.values();
|
||||
private static final PropertyEnum<TheWildPlants> TYPE = PropertyEnum.create("type", TheWildPlants.class);
|
||||
public static final PropertyEnum<TheWildPlants> TYPE = PropertyEnum.create("type", TheWildPlants.class);
|
||||
|
||||
public BlockWildPlant(String name){
|
||||
super(name);
|
||||
|
@ -53,7 +53,7 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
BlockPos offset = pos.down();
|
||||
IBlockState offsetState = world.getBlockState(offset);
|
||||
Block offsetBlock = offsetState.getBlock();
|
||||
return this.getMetaFromState(state) == TheWildPlants.RICE.ordinal() ? offsetBlock.getMaterial(offsetState) == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
||||
return this.getMetaFromState(state) == TheWildPlants.RICE.ordinal() ? offsetState.getMaterial() == Material.WATER : offsetBlock.canSustainPlant(offsetState, world, offset, EnumFacing.UP, this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class BlockWildPlant extends BlockBushBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList list){
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
for(int j = 0; j < ALL_WILD_PLANTS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
}
|
||||
|
|
|
@ -155,7 +155,6 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos){
|
||||
super.neighborChanged(state, worldIn, pos, blockIn, otherPos);
|
||||
this.neighborsChangedCustom(worldIn, pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -30,10 +29,10 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
import java.text.NumberFormat;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderBatteryBox extends TileEntitySpecialRenderer{
|
||||
public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatteryBox>{
|
||||
|
||||
@Override
|
||||
public void render(TileEntity tile, double x, double y, double z, float par5, int par6, float f){
|
||||
public void render(TileEntityBatteryBox tile, double x, double y, double z, float par5, int par6, float f){
|
||||
if(!(tile instanceof TileEntityBatteryBox)){
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,17 +20,15 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderCompost extends TileEntitySpecialRenderer{
|
||||
public class RenderCompost extends TileEntitySpecialRenderer<TileEntityCompost>{
|
||||
|
||||
@Override
|
||||
public void render(TileEntity te, double x, double y, double z, float partialTicks, int destroyStage, float f){
|
||||
if(te instanceof TileEntityCompost){
|
||||
TileEntityCompost compost = (TileEntityCompost)te;
|
||||
public void render(TileEntityCompost compost, double x, double y, double z, float partialTicks, int destroyStage, float f){
|
||||
if(compost instanceof TileEntityCompost){
|
||||
ItemStack slot = compost.slots.getStackInSlot(0);
|
||||
|
||||
if(StackUtil.isValid(slot)){
|
||||
|
|
|
@ -19,15 +19,14 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderDisplayStand extends TileEntitySpecialRenderer{
|
||||
public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisplayStand>{
|
||||
|
||||
@Override
|
||||
public void render(TileEntity tile, double x, double y, double z, float par5, int par6, float f){
|
||||
public void render(TileEntityDisplayStand tile, double x, double y, double z, float par5, int par6, float f){
|
||||
if(!(tile instanceof TileEntityDisplayStand)){
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,17 +21,16 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderEmpowerer extends TileEntitySpecialRenderer{
|
||||
public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpowerer>{
|
||||
|
||||
@Override
|
||||
public void render(TileEntity tile, double x, double y, double z, float par5, int par6, float f){
|
||||
public void render(TileEntityEmpowerer tile, double x, double y, double z, float par5, int par6, float f){
|
||||
if(!(tile instanceof TileEntityEmpowerer)){
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
|||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderLaserRelay extends TileEntitySpecialRenderer{
|
||||
public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserRelay>{
|
||||
|
||||
private static final float[] COLOR = new float[]{1F, 0F, 0F};
|
||||
private static final float[] COLOR_ITEM = new float[]{0F, 124F/255F, 16F/255F};
|
||||
|
@ -41,7 +41,7 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer{
|
|||
private static final float[] COLOR_INFRARED = new float[]{209F/255F, 179F/255F, 239F/255F};
|
||||
|
||||
@Override
|
||||
public void render(TileEntity tile, double x, double y, double z, float par5, int par6, float f){
|
||||
public void render(TileEntityLaserRelay tile, double x, double y, double z, float par5, int par6, float f){
|
||||
if(tile instanceof TileEntityLaserRelay){
|
||||
TileEntityLaserRelay relay = (TileEntityLaserRelay)tile;
|
||||
boolean hasInvis = false;
|
||||
|
@ -97,7 +97,7 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isGlobalRenderer(TileEntity tile){
|
||||
public boolean isGlobalRenderer(TileEntityLaserRelay tile){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,15 +19,14 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderReconstructorLens extends TileEntitySpecialRenderer{
|
||||
public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntityAtomicReconstructor>{
|
||||
|
||||
@Override
|
||||
public void render(TileEntity tile, double x, double y, double z, float par5, int par6, float f){
|
||||
public void render(TileEntityAtomicReconstructor tile, double x, double y, double z, float par5, int par6, float f){
|
||||
if(!(tile instanceof TileEntityAtomicReconstructor)){
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -22,19 +22,17 @@ import net.minecraft.block.state.IBlockState;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud>{
|
||||
|
||||
@Override
|
||||
public void render(TileEntity tile, double x, double y, double z, float par5, int partial, float f){
|
||||
if(tile instanceof TileEntitySmileyCloud){
|
||||
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
|
||||
public void render(TileEntitySmileyCloud theCloud, double x, double y, double z, float par5, int partial, float f){
|
||||
if(theCloud instanceof TileEntitySmileyCloud){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)x+0.5F, (float)y-0.5F, (float)z+0.5F);
|
||||
|
@ -63,6 +61,8 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
|||
case WEST:
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class RenderSmileyCloud extends TileEntitySpecialRenderer{
|
|||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI){
|
||||
if(mc.player.getDistanceSq(tile.getPos()) <= 36){
|
||||
if(mc.player.getDistanceSq(theCloud.getPos()) <= 36){
|
||||
AssetUtil.renderNameTag(theCloud.name, x+0.5F, y+1.5F, z+0.5F);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.gen;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockMisc;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockWildPlant;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheWildPlants;
|
||||
|
@ -19,9 +21,12 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
|||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.state.pattern.BlockMatcher;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -68,7 +73,7 @@ public class OreGen implements IWorldGenerator{
|
|||
|
||||
private void generateDefault(World world, Random random, int x, int z){
|
||||
if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()){
|
||||
this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.STONE, world, random, x*16, z*16, MathHelper.getInt(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
|
||||
this.addOreSpawn(InitBlocks.blockMisc.getDefaultState().withProperty(BlockMisc.TYPE, TheMiscBlocks.ORE_QUARTZ), Blocks.STONE, world, random, x*16, z*16, MathHelper.getInt(random, 5, 8), 10, QUARTZ_MIN, QUARTZ_MAX);
|
||||
}
|
||||
|
||||
if(ConfigBoolValues.GEN_LUSH_CAVES.isEnabled()){
|
||||
|
@ -86,12 +91,12 @@ public class OreGen implements IWorldGenerator{
|
|||
}
|
||||
}
|
||||
|
||||
public void addOreSpawn(Block block, int meta, Block blockIn, World world, Random random, int blockXPos, int blockZPos, int maxVeinSize, int chancesToSpawn, int minY, int maxY){
|
||||
public void addOreSpawn(IBlockState state, Block blockIn, World world, Random random, int blockXPos, int blockZPos, int maxVeinSize, int chancesToSpawn, int minY, int maxY){
|
||||
for(int i = 0; i < chancesToSpawn; i++){
|
||||
int posX = blockXPos+random.nextInt(16);
|
||||
int posY = minY+random.nextInt(maxY-minY);
|
||||
int posZ = blockZPos+random.nextInt(16);
|
||||
new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockMatcher.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ));
|
||||
new WorldGenMinable(state, maxVeinSize, BlockMatcher.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,10 +106,11 @@ public class OreGen implements IWorldGenerator{
|
|||
if(event.getType() == EventType.FLOWERS){
|
||||
if(!ArrayUtils.contains(ConfigIntListValues.PLANT_DIMENSION_BLACKLIST.getValue(), event.getWorld().provider.getDimension())){
|
||||
this.generateRice(event);
|
||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
|
||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.GRASS, event);
|
||||
this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.COFFEE.ordinal(), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.GRASS, event);
|
||||
this.genPlantNormally(InitBlocks.blockBlackLotus, 0, ConfigIntValues.BLACK_LOTUS_AMOUNT.getValue(), ConfigBoolValues.DO_LOTUS_GEN.isEnabled(), Material.GRASS, event);
|
||||
IBlockState plantDefault = InitBlocks.blockWildPlant.getDefaultState();
|
||||
this.genPlantNormally(plantDefault.withProperty(BlockWildPlant.TYPE, TheWildPlants.CANOLA), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.GRASS, event);
|
||||
this.genPlantNormally(plantDefault.withProperty(BlockWildPlant.TYPE, TheWildPlants.FLAX), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.GRASS, event);
|
||||
this.genPlantNormally(plantDefault.withProperty(BlockWildPlant.TYPE, TheWildPlants.COFFEE), ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.GRASS, event);
|
||||
this.genPlantNormally(InitBlocks.blockBlackLotus.getDefaultState(), ConfigIntValues.BLACK_LOTUS_AMOUNT.getValue(), ConfigBoolValues.DO_LOTUS_GEN.isEnabled(), Material.GRASS, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +125,7 @@ public class OreGen implements IWorldGenerator{
|
|||
if(randomPos.getY() >= 25 && randomPos.getY() <= 45){
|
||||
if(event.getWorld().getBlockState(randomPos).getMaterial() == Material.WATER){
|
||||
if(event.getWorld().getBlockState(randomPos.down()).getMaterial().isSolid()){
|
||||
event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getStateFromMeta(event.getRand().nextInt(4)), 2);
|
||||
event.getWorld().setBlockState(randomPos, InitBlocks.blockTreasureChest.getDefaultState().withProperty(BlockHorizontal.FACING, EnumFacing.getHorizontal(event.getRand().nextInt(4))), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +148,7 @@ public class OreGen implements IWorldGenerator{
|
|||
ArrayList<Material> blocksAroundTop = WorldUtil.getMaterialsAround(event.getWorld(), posToGenAt);
|
||||
if(blocksAroundBottom.contains(Material.GRASS) || blocksAroundBottom.contains(Material.GROUND) || blocksAroundBottom.contains(Material.ROCK) || blocksAroundBottom.contains(Material.SAND)){
|
||||
if(!blocksAroundTop.contains(Material.WATER) && event.getWorld().getBlockState(posToGenAt).getMaterial() == Material.AIR){
|
||||
event.getWorld().setBlockState(posToGenAt, InitBlocks.blockWildPlant.getStateFromMeta(TheWildPlants.RICE.ordinal()), 2);
|
||||
event.getWorld().setBlockState(posToGenAt, InitBlocks.blockWildPlant.getDefaultState().withProperty(BlockWildPlant.TYPE, TheWildPlants.RICE), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +157,7 @@ public class OreGen implements IWorldGenerator{
|
|||
}
|
||||
}
|
||||
|
||||
private void genPlantNormally(Block plant, int meta, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){
|
||||
private void genPlantNormally(IBlockState plant, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){
|
||||
if(doIt){
|
||||
for(int i = 0; i < amount; i++){
|
||||
if(event.getRand().nextInt(100) == 0){
|
||||
|
@ -159,8 +165,8 @@ public class OreGen implements IWorldGenerator{
|
|||
randomPos = event.getWorld().getTopSolidOrLiquidBlock(randomPos);
|
||||
|
||||
if(event.getWorld().getBlockState(randomPos.down()).getMaterial() == blockBelow){
|
||||
if(plant.canPlaceBlockAt(event.getWorld(), randomPos) && event.getWorld().isAirBlock(randomPos)){
|
||||
event.getWorld().setBlockState(randomPos, plant.getStateFromMeta(meta), 2);
|
||||
if(plant.getBlock().canPlaceBlockAt(event.getWorld(), randomPos) && event.getWorld().isAirBlock(randomPos)){
|
||||
event.getWorld().setBlockState(randomPos, plant, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.gen.village.component;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -41,7 +42,7 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
|
|||
this.boundingBox = boundingBox;
|
||||
}
|
||||
|
||||
public static VillageComponentCustomCropField buildComponent(List pieces, int p1, int p2, int p3, EnumFacing p4){
|
||||
public static VillageComponentCustomCropField buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, EnumFacing p4){
|
||||
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
|
||||
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentCustomCropField(boundingBox, p4) : null;
|
||||
}
|
||||
|
@ -102,13 +103,13 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
|
|||
int randomMeta = MathHelper.getInt(rand, 1, 7);
|
||||
switch(rand.nextInt(4)){
|
||||
case 0:
|
||||
return InitBlocks.blockFlax.getStateFromMeta(randomMeta);
|
||||
return InitBlocks.blockFlax.getDefaultState().withProperty(BlockCrops.AGE, randomMeta);
|
||||
case 1:
|
||||
return InitBlocks.blockCoffee.getStateFromMeta(randomMeta);
|
||||
return InitBlocks.blockCoffee.getDefaultState().withProperty(BlockCrops.AGE, randomMeta);
|
||||
case 2:
|
||||
return InitBlocks.blockRice.getStateFromMeta(randomMeta);
|
||||
return InitBlocks.blockRice.getDefaultState().withProperty(BlockCrops.AGE, randomMeta);
|
||||
default:
|
||||
return InitBlocks.blockCanola.getStateFromMeta(randomMeta);
|
||||
return InitBlocks.blockCanola.getDefaultState().withProperty(BlockCrops.AGE, randomMeta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.gen.village.component;
|
|||
|
||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockColoredLamp;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
|
||||
|
@ -67,7 +68,7 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
|
|||
this.boundingBox = boundingBox;
|
||||
}
|
||||
|
||||
public static VillageComponentEngineerHouse buildComponent(List pieces, int p1, int p2, int p3, EnumFacing p4){
|
||||
public static VillageComponentEngineerHouse buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, EnumFacing p4){
|
||||
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
|
||||
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentEngineerHouse(boundingBox, p4) : null;
|
||||
}
|
||||
|
@ -171,7 +172,7 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
|
|||
}
|
||||
|
||||
int meta = world.rand.nextInt(TheColoredLampColors.values().length);
|
||||
this.setBlockState(world, InitBlocks.blockColoredLampOn.getStateFromMeta(meta), 8, 1, 6, sbb);
|
||||
this.setBlockState(world, InitBlocks.blockColoredLampOn.getDefaultState().withProperty(BlockColoredLamp.TYPE, BlockColoredLamp.ALL_LAMP_TYPES[meta]), 8, 1, 6, sbb);
|
||||
}
|
||||
|
||||
private void spawnActualHouse(World world, StructureBoundingBox sbb){
|
||||
|
|
|
@ -48,7 +48,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
|
|||
this.boundingBox = boundingBox;
|
||||
}
|
||||
|
||||
public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, EnumFacing p4){
|
||||
public static VillageComponentJamHouse buildComponent(List<StructureComponent> pieces, int p1, int p2, int p3, EnumFacing p4){
|
||||
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, X_SIZE, Y_SIZE, Z_SIZE, p4);
|
||||
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null;
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
|
|||
this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block.getDefaultState(), block.getDefaultState(), false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){
|
||||
//Base
|
||||
this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.GRASS);
|
||||
|
|
|
@ -24,16 +24,16 @@ import java.util.List;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class TexturedButton extends GuiButton{
|
||||
|
||||
public final List textList = new ArrayList();
|
||||
public final List<String> textList = new ArrayList<String>();
|
||||
private final ResourceLocation resLoc;
|
||||
public int texturePosX;
|
||||
public int texturePosY;
|
||||
|
||||
public TexturedButton(ResourceLocation resLoc, int id, int x, int y, int texturePosX, int texturePosY, int width, int height){
|
||||
this(resLoc, id, x, y, texturePosX, texturePosY, width, height, new ArrayList());
|
||||
this(resLoc, id, x, y, texturePosX, texturePosY, width, height, new ArrayList<String>());
|
||||
}
|
||||
|
||||
public TexturedButton(ResourceLocation resLoc, int id, int x, int y, int texturePosX, int texturePosY, int width, int height, List hoverTextList){
|
||||
public TexturedButton(ResourceLocation resLoc, int id, int x, int y, int texturePosX, int texturePosY, int width, int height, List<String> hoverTextList){
|
||||
super(id, x, y, width, height, "");
|
||||
this.texturePosX = texturePosX;
|
||||
this.texturePosY = texturePosY;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem{
|
|||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state, ItemStack stack){
|
||||
|
||||
return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getMaterial(state).isToolNotRequired() || (state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN ? this.toolMaterial.getHarvestLevel() >= 3 : (state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE ? (state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK ? (state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE ? (state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE ? (state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE ? (state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE ? (state.getBlock().getMaterial(state) == Material.ROCK || (state.getBlock().getMaterial(state) == Material.IRON || state.getBlock().getMaterial(state) == Material.ANVIL)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
|
||||
return this.hasExtraWhitelist(state.getBlock()) || state.getMaterial().isToolNotRequired() || (state.getBlock() == Blocks.SNOW_LAYER || state.getBlock() == Blocks.SNOW || (state.getBlock() == Blocks.OBSIDIAN ? this.toolMaterial.getHarvestLevel() >= 3 : (state.getBlock() != Blocks.DIAMOND_BLOCK && state.getBlock() != Blocks.DIAMOND_ORE ? (state.getBlock() != Blocks.EMERALD_ORE && state.getBlock() != Blocks.EMERALD_BLOCK ? (state.getBlock() != Blocks.GOLD_BLOCK && state.getBlock() != Blocks.GOLD_ORE ? (state.getBlock() != Blocks.IRON_BLOCK && state.getBlock() != Blocks.IRON_ORE ? (state.getBlock() != Blocks.LAPIS_BLOCK && state.getBlock() != Blocks.LAPIS_ORE ? (state.getBlock() != Blocks.REDSTONE_ORE && state.getBlock() != Blocks.LIT_REDSTONE_ORE ? (state.getMaterial() == Material.ROCK || (state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
|
||||
}
|
||||
|
||||
private boolean hasExtraWhitelist(Block block){
|
||||
|
|
|
@ -30,10 +30,10 @@ import net.minecraftforge.items.wrapper.InvWrapper;
|
|||
|
||||
public class ItemChestToCrateUpgrade extends ItemBase{
|
||||
|
||||
private final Class start;
|
||||
private final Class<? extends TileEntity> start;
|
||||
private final IBlockState end;
|
||||
|
||||
public ItemChestToCrateUpgrade(String name, Class start, IBlockState end){
|
||||
public ItemChestToCrateUpgrade(String name, Class<? extends TileEntity> start, IBlockState end){
|
||||
super(name);
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ItemCrystal extends ItemBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tab)){
|
||||
for(int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ItemCrystalShard extends ItemBase implements IColorProvidingItem{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tab)){
|
||||
for(int j = 0; j < BlockCrystal.ALL_CRYSTALS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
|
|
@ -247,7 +247,7 @@ public class ItemDrill extends ItemEnergy{
|
|||
@Override
|
||||
public boolean canHarvestBlock(IBlockState state, ItemStack stack){
|
||||
Block block = state.getBlock();
|
||||
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial(state).isToolNotRequired() || (block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? HARVEST_LEVEL >= 3 : (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? (block.getMaterial(state) == Material.ROCK || (block.getMaterial(state) == Material.IRON || block.getMaterial(state) == Material.ANVIL)) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2))));
|
||||
return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || state.getMaterial().isToolNotRequired() || (block == Blocks.SNOW_LAYER || block == Blocks.SNOW || (block == Blocks.OBSIDIAN ? HARVEST_LEVEL >= 3 : (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE ? (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK ? (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE ? (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE ? (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE ? (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE ? (state.getMaterial() == Material.ROCK || (state.getMaterial() == Material.IRON || state.getMaterial() == Material.ANVIL)) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 1) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2) : HARVEST_LEVEL >= 2))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -328,7 +328,7 @@ public class ItemDrill extends ItemEnergy{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tabs, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tabs, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tabs)){
|
||||
for(int i = 0; i < 16; i++){
|
||||
this.addDrillStack(list, i);
|
||||
|
@ -336,7 +336,7 @@ public class ItemDrill extends ItemEnergy{
|
|||
}
|
||||
}
|
||||
|
||||
private void addDrillStack(List list, int meta){
|
||||
private void addDrillStack(List<ItemStack> list, int meta){
|
||||
ItemStack stackFull = new ItemStack(this, 1, meta);
|
||||
this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull));
|
||||
list.add(stackFull);
|
||||
|
@ -454,7 +454,7 @@ public class ItemDrill extends ItemEnergy{
|
|||
private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use){
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
float hardness = block.getBlockHardness(state, world, pos);
|
||||
float hardness = state.getBlockHardness(world, pos);
|
||||
boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getStrVsBlock(stack, world.getBlockState(pos)) > 1.0F);
|
||||
if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ItemDust extends ItemBase implements IColorProvidingItem{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tab)){
|
||||
for(int j = 0; j < ALL_DUSTS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
|
|
@ -94,7 +94,7 @@ public class ItemFoods extends ItemFoodBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tab)){
|
||||
for(int j = 0; j < ALL_FOODS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ItemJams extends ItemFoodBase implements IColorProvidingItem{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tab)){
|
||||
for(int j = 0; j < ALL_JAMS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
|
|
@ -42,8 +42,8 @@ public class ItemKnife extends ItemBase{
|
|||
|
||||
|
||||
@Override
|
||||
public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){
|
||||
Multimap map = super.getAttributeModifiers(slot, stack);
|
||||
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){
|
||||
Multimap<String, AttributeModifier> map = super.getAttributeModifiers(slot, stack);
|
||||
if(slot == EntityEquipmentSlot.MAINHAND){
|
||||
map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Knife Modifier", 3, 0));
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ItemMisc extends ItemBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tab)){
|
||||
for(int j = 0; j < ALL_MISC_ITEMS.length; j++){
|
||||
if(j != TheMiscItems.YOUTUBE_ICON.ordinal()){
|
||||
|
|
|
@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.IColorProvidingItem;
|
|||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
@ -130,12 +131,20 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack){
|
||||
if(Util.isClient()) {
|
||||
String standardName = StringUtil.localize(this.getUnlocalizedName()+".name");
|
||||
if(stack.getItemDamage() < ALL_RINGS.length){
|
||||
String effect = StringUtil.localize(ALL_RINGS[stack.getItemDamage()].name);
|
||||
return standardName+" "+effect;
|
||||
}
|
||||
return standardName;
|
||||
}
|
||||
String standardName = StringUtil.localizeIllegallyOnTheServerDontUseMePls(this.getUnlocalizedName()+".name");
|
||||
if(stack.getItemDamage() < ALL_RINGS.length){
|
||||
String effect = StringUtil.localizeIllegallyOnTheServerDontUseMePls(ALL_RINGS[stack.getItemDamage()].name);
|
||||
return standardName+" "+effect;
|
||||
}
|
||||
return standardName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -145,7 +154,7 @@ public class ItemPotionRing extends ItemBase implements IColorProvidingItem, IDi
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tab, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tab)){
|
||||
for(int j = 0; j < ALL_RINGS.length; j++){
|
||||
list.add(new ItemStack(this, 1, j));
|
||||
|
|
|
@ -92,28 +92,28 @@ public class ItemWaterBowl extends ItemBase{
|
|||
}
|
||||
|
||||
if(trace == null){
|
||||
return new ActionResult(EnumActionResult.PASS, stack);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
|
||||
}
|
||||
else if(trace.typeOfHit != RayTraceResult.Type.BLOCK){
|
||||
return new ActionResult(EnumActionResult.PASS, stack);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.PASS, stack);
|
||||
}
|
||||
else{
|
||||
BlockPos pos = trace.getBlockPos();
|
||||
|
||||
if(!world.isBlockModifiable(player, pos)){
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
else{
|
||||
BlockPos pos1 = world.getBlockState(pos).getBlock().isReplaceable(world, pos) && trace.sideHit == EnumFacing.UP ? pos : pos.offset(trace.sideHit);
|
||||
|
||||
if(!player.canPlayerEdit(pos1, trace.sideHit, stack)){
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
else if(this.tryPlaceContainedLiquid(player, world, pos1, false)){
|
||||
return !player.capabilities.isCreativeMode ? new ActionResult(EnumActionResult.SUCCESS, new ItemStack(Items.BOWL)) : new ActionResult(EnumActionResult.SUCCESS, stack);
|
||||
return !player.capabilities.isCreativeMode ? new ActionResult<ItemStack>(EnumActionResult.SUCCESS, new ItemStack(Items.BOWL)) : new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
else{
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public abstract class ItemEnergy extends ItemBase{
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(CreativeTabs tabs, NonNullList list){
|
||||
public void getSubItems(CreativeTabs tabs, NonNullList<ItemStack> list){
|
||||
if(this.isInCreativeTab(tabs)){
|
||||
ItemStack stackFull = new ItemStack(this);
|
||||
if(stackFull.hasCapability(CapabilityEnergy.ENERGY, null)){
|
||||
|
|
|
@ -68,10 +68,6 @@ public final class InitOreDict{
|
|||
addOre(item, 0, name);
|
||||
}
|
||||
|
||||
private static void addOre(Block block, String name){
|
||||
addOre(block, 0, name);
|
||||
}
|
||||
|
||||
private static void addOre(Block block, int meta, String name){
|
||||
addOre(new ItemStack(block, 1, meta), name);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class ClientProxy implements IProxy{
|
|||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEmpowerer.class, new RenderEmpowerer());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBatteryBox.class, new RenderBatteryBox());
|
||||
|
||||
TileEntitySpecialRenderer laser = new RenderLaserRelay();
|
||||
TileEntitySpecialRenderer<TileEntityLaserRelay> laser = new RenderLaserRelay();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayEnergy.class, laser);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayEnergyAdvanced.class, laser);
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityLaserRelayEnergyExtreme.class, laser);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
|||
BlockPos coordsBlock = this.pos.offset(sideToManipulate);
|
||||
IBlockState stateToBreak = this.world.getBlockState(coordsBlock);
|
||||
Block blockToBreak = stateToBreak.getBlock();
|
||||
if(!this.isPlacer && blockToBreak != null && !this.world.isAirBlock(coordsBlock) && !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && blockToBreak.getBlockHardness(stateToBreak, this.world, coordsBlock) >= 0.0F){
|
||||
if(!this.isPlacer && blockToBreak != null && !this.world.isAirBlock(coordsBlock) && !(blockToBreak instanceof BlockLiquid) && !(blockToBreak instanceof IFluidBlock) && stateToBreak.getBlockHardness(this.world, coordsBlock) >= 0.0F){
|
||||
List<ItemStack> drops = blockToBreak.getDrops(this.world, coordsBlock, stateToBreak, 0);
|
||||
float chance = WorldUtil.fireFakeHarvestEventsForDropChance(drops, this.world, coordsBlock);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements ISharingE
|
|||
BlockPos coords = this.pos.offset(WorldUtil.getDirectionBySidesInOrder(i));
|
||||
IBlockState state = this.world.getBlockState(coords);
|
||||
Block block = state.getBlock();
|
||||
if(block != null && block.getMaterial(this.world.getBlockState(coords)) == Material.LAVA && block.getMetaFromState(state) == 0){
|
||||
if(block != null && this.world.getBlockState(coords).getMaterial() == Material.LAVA && block.getMetaFromState(state) == 0){
|
||||
blocksAround.add(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.util;
|
|||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -26,22 +26,29 @@ public final class StringUtil{
|
|||
public static final String BUGGED_ITEM_NAME = ModUtil.MOD_ID+".lolWutHowUDoDis";
|
||||
|
||||
/**
|
||||
* Localizes a given String via StatCollector
|
||||
* Localizes a given String
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static String localize(String text){
|
||||
return I18n.translateToLocal(text);
|
||||
return I18n.format(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Localizes a given formatted String with the given Replacements
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static String localizeFormatted(String text, Object... replace){
|
||||
return I18n.translateToLocalFormatted(text, replace);
|
||||
return I18n.format(text, replace);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")//TODO: delete this shit and move ItemPotionRing's getItemStackDisplayName into getUnlocalizedName
|
||||
public static String localizeIllegallyOnTheServerDontUseMePls(String langKey) {
|
||||
return net.minecraft.util.text.translation.I18n.translateToLocal(langKey);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void drawSplitString(FontRenderer renderer, String strg, int x, int y, int width, int color, boolean shadow){
|
||||
List list = renderer.listFormattedStringToWidth(strg, width);
|
||||
List<String> list = renderer.listFormattedStringToWidth(strg, width);
|
||||
for(int i = 0; i < list.size(); i++){
|
||||
String s1 = (String)list.get(i);
|
||||
renderer.drawString(s1, x, y+(i*renderer.FONT_HEIGHT), color, shadow);
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.item.EnumRarity;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -40,6 +41,10 @@ public final class Util{
|
|||
return ModUtil.VERSION.equals("@VERSION@");
|
||||
}
|
||||
|
||||
public static boolean isClient(){
|
||||
return FMLCommonHandler.instance().getEffectiveSide().isClient();
|
||||
}
|
||||
|
||||
private static String[] splitVersion(){
|
||||
return ModUtil.VERSION.split("-");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue