Misc touchups everywhere. Move ModBanners in block pkg

This commit is contained in:
Vincent Lee committed 2015-11-26 17:33:36 -06:00
1 parent bf81e002e8
commit e679a2062d
32 files changed
+182 -178

No files matched your search

@@ -18,9 +18,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.*;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
@@ -84,7 +86,7 @@ public final class BotaniaAPI {
public static Map<String, Integer> oreWeightsNether = new HashMap<String, Integer>();
public static Map<Item, Block> seeds = new HashMap();
public static Set<Item> looniumBlacklist = new LinkedHashSet();
public static Set<Block> paintableBlocks = new LinkedHashSet<Block>();
public static Map<Block, PropertyEnum> paintableBlocks = new LinkedHashMap<Block, PropertyEnum>();
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", "manasteel", 16, new int[] { 2, 6, 5, 2 }, 18);
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
@@ -230,11 +232,11 @@ public final class BotaniaAPI {
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
registerPaintableBlock(Blocks.stained_glass);
registerPaintableBlock(Blocks.stained_glass_pane);
registerPaintableBlock(Blocks.stained_hardened_clay);
registerPaintableBlock(Blocks.wool);
registerPaintableBlock(Blocks.carpet);
registerPaintableBlock(Blocks.stained_glass, BlockStainedGlass.COLOR);
registerPaintableBlock(Blocks.stained_glass_pane, BlockStainedGlassPane.COLOR);
registerPaintableBlock(Blocks.stained_hardened_clay, BlockColored.COLOR);
registerPaintableBlock(Blocks.wool, BlockColored.COLOR);
registerPaintableBlock(Blocks.carpet, BlockCarpet.COLOR);
}
/**
@@ -276,10 +278,18 @@ public final class BotaniaAPI {
/**
* Registers a paintableBlock and returns it.
* You must also provide the PropertyEnum that this block uses to express its color
* The component type of the property must be EnumDyeColor
*/
public static Block registerPaintableBlock(Block paintable){
paintableBlocks.add(paintable);
public static Block registerPaintableBlock(Block paintable, PropertyEnum colorProp){
if (colorProp.getValueClass() != EnumDyeColor.class) {
throw new IllegalArgumentException("Must be EnumDyeColor");
}
paintableBlocks.put(paintable, colorProp);
return paintable;
//todo 1.8 improve this
}
/**
@@ -151,7 +151,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IPickup
placeDoubleFlower(world, x, y, z, meta, 1 | 2);
}
public static void placeDoubleFlower(World world, int x, int y, int z, int meta, int flags) {
public static void placeDoubleFlower(World world, BlockPos pos, EnumDyeColor color, int flags) {
Block flower = meta >= 8 ? ModBlocks.doubleFlower2 : ModBlocks.doubleFlower1;
int placeMeta = meta & 7;
world.setBlock(x, y, z, flower, placeMeta, flags);
@@ -0,0 +1,48 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 25, 2015, 7:11:35 PM (GMT)]
*/
package vazkii.botania.common.block;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityBanner;
import net.minecraftforge.common.util.EnumHelper;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ModItems;
public final class ModBanners {
public static void init() {
Class<? extends Enum<?>> clazz = TileEntityBanner.EnumBannerPattern.class;
addPattern(clazz, "flower", "flr", new ItemStack(ModItems.manaResource, 1, 3));
addPattern(clazz, "lexicon", "lex", new ItemStack(ModItems.lexicon));
addPattern(clazz, "logo", "lgo", new ItemStack(ModItems.manaResource, 1, 4));
addPattern(clazz, "sapling", "spl", new ItemStack(ModItems.manaResource, 1, 13));
addPattern(clazz, "tiny_potato", "tpt", new ItemStack(ModBlocks.tinyPotato));
addPattern(clazz, "spark_dispersive", "sds", new ItemStack(ModItems.sparkUpgrade, 1, 0));
addPattern(clazz, "spark_dominant", "sdm", new ItemStack(ModItems.sparkUpgrade, 1, 1));
addPattern(clazz, "spark_recessive", "src", new ItemStack(ModItems.sparkUpgrade, 1, 2));
addPattern(clazz, "spark_isolated", "sis", new ItemStack(ModItems.sparkUpgrade, 1, 3));
addPattern(clazz, "fish", "fis", new ItemStack(Items.fish));
addPattern(clazz, "axe", "axe", new ItemStack(Items.iron_axe));
addPattern(clazz, "hoe", "hoe", new ItemStack(Items.iron_hoe));
addPattern(clazz, "pickaxe", "pik", new ItemStack(Items.iron_pickaxe));
addPattern(clazz, "shovel", "shv", new ItemStack(Items.iron_shovel));
addPattern(clazz, "sword", "srd", new ItemStack(Items.iron_sword));
}
public static void addPattern(Class<? extends Enum<?>> clazz, String name, String id, ItemStack craftingItem) {
name = "botania_" + name;
id = "bt_" + id;
EnumHelper.addEnum(clazz, name.toUpperCase(), new Class[] { String.class, String.class, ItemStack.class }, new Object[] { name, id, craftingItem });
}
}
@@ -44,7 +44,7 @@ public class CommandSkyblockSpread extends CommandBase {
int maxrange = 200000;
if(args.length == 2)
maxrange = parseInt(sender, args[1]); // <- todo 1.8 wat
maxrange = parseInt(args[1]);
if(maxrange > maxAllowed)
throw new CommandException("botaniamisc.skyblockRangeTooHigh");
@@ -10,11 +10,13 @@
*/
package vazkii.botania.common.core.handler;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.BlockPos;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
import vazkii.botania.api.item.IFlowerlessBiome;
import vazkii.botania.api.item.IFlowerlessWorld;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.block.BlockModFlower;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
@@ -45,7 +47,7 @@ public class BiomeDecorationHandler {
int z = event.pos.getZ() + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(event.pos).getY();
int color = event.rand.nextInt(16);
EnumDyeColor color = EnumDyeColor.byMetadata(event.rand.nextInt(16));
boolean primus = event.rand.nextInt(380) == 0;
for(int j = 0; j < ConfigHandler.flowerDensity * ConfigHandler.flowerPatchChance; j++) {
@@ -53,7 +55,7 @@ public class BiomeDecorationHandler {
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
int z1 = z + event.rand.nextInt(dist * 2) - dist;
BlockPos pos2 = new BlockPos(x1, y1, z1);
if(event.world.isAirBlock(pos2) && (!event.world.provider.getHasNoSky() || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1)) {
if(event.world.isAirBlock(pos2) && (!event.world.provider.getHasNoSky() || y1 < 127) && ModBlocks.flower.canPlaceBlockAt(event.world, pos2)) {
if(primus) {
event.world.setBlockState(pos2, ModBlocks.specialFlower.getDefaultState(), 2);
TileSpecialFlower flower = (TileSpecialFlower) event.world.getTileEntity(pos2);
@@ -61,9 +63,9 @@ public class BiomeDecorationHandler {
SubTileDaybloom subtile = (SubTileDaybloom) flower.getSubTile();
subtile.setPrimusPosition();
} else {
event.world.setBlockState(pos2, ModBlocks.flower, color, 2);
if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).func_149851_a(event.world, x1, y1, z1, false))
BlockModFlower.placeDoubleFlower(event.world, x1, y1, z1, color, 0);
event.world.setBlockState(pos2, ModBlocks.flower.getDefaultState().withProperty(BotaniaStateProps.COLOR, color), 2);
if(event.rand.nextDouble() < ConfigHandler.flowerTallChance && ((BlockModFlower) ModBlocks.flower).canGrow(event.world, pos2, event.world.getBlockState(pos2), false))
BlockModFlower.placeDoubleFlower(event.world, pos2, color, 0);
}
}
}
@@ -75,9 +77,9 @@ public class BiomeDecorationHandler {
int z = event.pos.getZ() + event.rand.nextInt(16) + 8;
int y = event.rand.nextInt(26) + 4;
BlockPos pos3 = new BlockPos(x, y, z);
int color = event.rand.nextInt(16);
if(event.world.isAirBlock(pos3) && ModBlocks.mushroom.canBlockStay(event.world, x, y, z))
event.world.setBlockState(pos3, ModBlocks.mushroom, color, 2);
EnumDyeColor color = EnumDyeColor.byMetadata(event.rand.nextInt(16));
if(event.world.isAirBlock(pos3) && ModBlocks.mushroom.canPlaceBlockAt(event.world, pos3))
event.world.setBlockState(pos3, ModBlocks.mushroom.getDefaultState().withProperty(BotaniaStateProps.COLOR, color), 2);
}
}
}
@@ -92,7 +92,7 @@ public final class ManaNetworkHandler implements IManaNetwork {
TileEntity tile = sig.tile;
if(tile.isInvalid())
continue;
float distance = MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, pos.posX, pos.posY, pos.posZ);
float distance = MathHelper.pointDistanceSpace(tile.getPos(), pos);
if(distance > limit)
continue;
@@ -29,11 +29,11 @@ public final class SpawnerChangingHandler {
if(event.entityPlayer.capabilities.isCreativeMode && !event.world.isRemote && event.action == Action.RIGHT_CLICK_BLOCK && !event.entityPlayer.isSneaking()) {
ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
if(stack != null && stack.getItem() == Items.spawn_egg) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
TileEntity tile = event.world.getTileEntity(event.pos);
if(tile instanceof TileEntityMobSpawner) {
TileEntityMobSpawner spawner = (TileEntityMobSpawner) tile;
spawner.func_145881_a().setEntityName(EntityList.getStringFromID(stack.getItemDamage()));
event.world.markBlockForUpdate(event.x, event.y, event.z);
spawner.getSpawnerBaseLogic().setEntityName(EntityList.getStringFromID(stack.getItemDamage()));
event.world.markBlockForUpdate(event.pos);
event.setCanceled(true);
}
}
@@ -18,12 +18,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibObfuscation;
// This is legacy code and is no longer used. Check out TileTerraPlate instead.
public final class TerrasteelCraftingHandler {
@@ -43,23 +46,21 @@ public final class TerrasteelCraftingHandler {
item.worldObj.playSoundAtEntity(item, "botania:terrasteelCraft", 1F, 1F);
getManaFromPools : {
int x = MathHelper.floor_double(item.posX);
int y = MathHelper.floor_double(item.posY);
int z = MathHelper.floor_double(item.posZ);
BlockPos pos = new BlockPos(item);
int range = 12;
for(int i = -range; i < range + 1; i++)
for(int j = -range; j < range + 1; j++)
for(int k = - range; k < range + 1; k++) {
TileEntity tile = item.worldObj.getTileEntity(x + i, y + j, z + k);
BlockPos pos_ = pos.add(i, j, k);
TileEntity tile = item.worldObj.getTileEntity(pos_);
if(tile instanceof IManaPool) {
IManaPool pool = (IManaPool) tile;
if(!item.worldObj.isRemote && pool.getCurrentMana() >= MANA_PER_TICK) {
pool.recieveMana(-MANA_PER_TICK);
item.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
item.worldObj.markBlockForUpdate(tile.getPos());
incrementCraftingTime(item, time);
break getManaFromPools;
}
@@ -75,18 +76,16 @@ public final class TerrasteelCraftingHandler {
if(estack.stackSize != 1)
return -1;
int x = MathHelper.floor_double(item.posX);
int y = MathHelper.floor_double(item.posY);
int z = MathHelper.floor_double(item.posZ);
BlockPos pos = new BlockPos(item);
if(item.worldObj.getBlock(x, y - 1, z) != Blocks.beacon)
if(item.worldObj.getBlockState(pos.down()).getBlock() != Blocks.beacon)
return -1;
TileEntityBeacon beacon = (TileEntityBeacon) item.worldObj.getTileEntity(x, y - 1, z);
if(beacon.getLevels() <= 0)
TileEntityBeacon beacon = (TileEntityBeacon) item.worldObj.getTileEntity(pos.down());
if(beacon.getField(0) <= 0) // Field 0 -> levels
return -1;
List<EntityItem> items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(x, y, z, x + 1, y + 1, z + 1));
List<EntityItem> items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
EntityItem diamond = null;
EntityItem pearl = null;
@@ -115,12 +114,12 @@ public final class TerrasteelCraftingHandler {
if(diamond != null && pearl != null) {
int time = getTimeInCrafting(item);
if(time > 0) {
diamond.delayBeforeCanPickup = 1;
diamond.age = 0;
pearl.delayBeforeCanPickup = 1;
pearl.age = 0;
item.delayBeforeCanPickup = 1;
item.age = 0;
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, diamond, 1, LibObfuscation.PICKUP_DELAY);
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, diamond, 0, LibObfuscation.AGE);
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, pearl, 1, LibObfuscation.PICKUP_DELAY);
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, pearl, 0, LibObfuscation.AGE);
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, item, 1, LibObfuscation.PICKUP_DELAY);
ObfuscationReflectionHelper.setPrivateValue(EntityItem.class, item, 0, LibObfuscation.AGE);
}
return time;
@@ -30,6 +30,7 @@ import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.LexiconPage;
import vazkii.botania.common.Botania;
import vazkii.botania.common.achievement.ModAchievements;
import vazkii.botania.common.block.ModBanners;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModMultiblocks;
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
@@ -62,7 +63,7 @@ import vazkii.botania.common.crafting.ModRuneRecipes;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.entity.ModEntities;
//import vazkii.botania.common.integration.buildcraft.StatementAPIPlugin; todo 1.8
//import vazkii.botania.common.integration.etfuturum.ModBanners;
//import vazkii.botania.common.block.ModBanners;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.network.GuiHandler;
@@ -101,9 +102,7 @@ public class CommonProxy {
ModBrewRecipes.init();
ModAchievements.init();
ModMultiblocks.init();
if(Botania.etFuturumLoaded)
// todo 1.8 ModBanners.init();
ModBanners.init();
ChestGenHandler.init();
@@ -17,8 +17,10 @@ import java.util.List;
import java.util.regex.Pattern;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
@@ -55,6 +57,8 @@ import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.MultiblockSet;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.PylonVariant;
import vazkii.botania.client.core.handler.BossBarHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.Botania;
@@ -119,14 +123,14 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
public static MultiblockSet makeMultiblockSet() {
Multiblock mb = new Multiblock();
for(int[] p : PYLON_LOCATIONS)
mb.addComponent(, p[0], ModBlocks.pylon, 2);
for(BlockPos p : PYLON_LOCATIONS)
mb.addComponent(p, ModBlocks.pylon, 2);
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
mb.addComponent(new BeaconComponent(new BlockPos(i - 1, 0, j - 1)));
mb.addComponent(, 0, Blocks.beacon, 0);
mb.addComponent(new BlockPos(0, 1, 0), Blocks.beacon, 0);
mb.setRenderOffset(0, -1, 0);
return mb.makeSet();
@@ -144,9 +148,9 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
for(BlockPos coords : PYLON_LOCATIONS) {
BlockPos pos_ = pos.add(coords);
Block blockat = par3World.getBlock(x, y, z);
int meta = par3World.getBlockMetadata(x, y, z);
if(blockat != ModBlocks.pylon || meta != 2) {
IBlockState state = par3World.getBlockState(pos_);
Block blockat = state.getBlock();
if(blockat != ModBlocks.pylon || state.getValue(BotaniaStateProps.PYLON_VARIANT) != PylonVariant.GAIA) {
if(!par3World.isRemote)
player.addChatMessage(new ChatComponentTranslation("botaniamisc.needsCatalysts").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
return false;
@@ -47,8 +47,8 @@ import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.equipment.bauble.ItemTinyPlanet;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class EntityManaBurst extends EntityThrowable implements IManaBurst {
@@ -394,7 +394,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
@Override
@SideOnly(Side.CLIENT)
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_) {
public void setPositionAndRotation2(double p_70056_1_, double p_70056_3_, double p_70056_5_, float p_70056_7_, float p_70056_8_, int p_70056_9_, boolean p_70056_10_) {
setPosition(p_70056_1_, p_70056_3_, p_70056_5_);
setRotation(p_70056_7_, p_70056_8_);
}
@@ -21,7 +21,9 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibObfuscation;
public class EntityThrownItem extends EntityItem {
@@ -33,7 +35,12 @@ public class EntityThrownItem extends EntityItem {
double p_i1710_4_, double p_i1710_6_, EntityItem item) {
super(p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_, item.getEntityItem());
delayBeforeCanPickup = item.delayBeforeCanPickup;
ObfuscationReflectionHelper.setPrivateValue(
EntityItem.class,
this,
ObfuscationReflectionHelper.getPrivateValue(EntityItem.class, item, LibObfuscation.PICKUP_DELAY),
LibObfuscation.PICKUP_DELAY
);
motionX = item.motionX;
motionY = item.motionY;
motionZ = item.motionZ;
@@ -63,7 +70,7 @@ public class EntityThrownItem extends EntityItem {
{
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || delayBeforeCanPickup == 0))
if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || ((Integer) ObfuscationReflectionHelper.getPrivateValue(EntityItem.class, this, LibObfuscation.PICKUP_DELAY)) == 0))
{
float f = 1.0F;
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f, f, f);
@@ -1,51 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Aug 25, 2015, 7:11:35 PM (GMT)]
*/
package vazkii.botania.common.integration.etfuturum;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.item.ModItems;
public final class ModBanners {
public static void init() {
try {
Class<Enum<?>> clazz = (Class<Enum<?>>) Class.forName("ganymedes01.etfuturum.tileentities.TileEntityBanner$EnumBannerPattern");
addPattern(clazz, "flower", "flr", new ItemStack(ModItems.manaResource, 1, 3));
addPattern(clazz, "lexicon", "lex", new ItemStack(ModItems.lexicon));
addPattern(clazz, "logo", "lgo", new ItemStack(ModItems.manaResource, 1, 4));
addPattern(clazz, "sapling", "spl", new ItemStack(ModItems.manaResource, 1, 13));
addPattern(clazz, "tiny_potato", "tpt", new ItemStack(ModBlocks.tinyPotato));
addPattern(clazz, "spark_dispersive", "sds", new ItemStack(ModItems.sparkUpgrade, 1, 0));
addPattern(clazz, "spark_dominant", "sdm", new ItemStack(ModItems.sparkUpgrade, 1, 1));
addPattern(clazz, "spark_recessive", "src", new ItemStack(ModItems.sparkUpgrade, 1, 2));
addPattern(clazz, "spark_isolated", "sis", new ItemStack(ModItems.sparkUpgrade, 1, 3));
addPattern(clazz, "fish", "fis", new ItemStack(Items.fish));
addPattern(clazz, "axe", "axe", new ItemStack(Items.iron_axe));
addPattern(clazz, "hoe", "hoe", new ItemStack(Items.iron_hoe));
addPattern(clazz, "pickaxe", "pik", new ItemStack(Items.iron_pickaxe));
addPattern(clazz, "shovel", "shv", new ItemStack(Items.iron_shovel));
addPattern(clazz, "sword", "srd", new ItemStack(Items.iron_sword));
} catch (ClassNotFoundException e) {
// Looks like we don't have EtFuturum around, let's not do any of this nonsense then
}
}
public static void addPattern(Class<Enum<?>> clazz, String name, String id, ItemStack craftingItem) {
name = "botania_" + name;
id = "bt_" + id;
EnumHelper.addEnum(clazz, name.toUpperCase(), new Class[] { String.class, String.class, ItemStack.class }, new Object[] { name, id, craftingItem });
}
}
@@ -114,49 +114,30 @@ public class ItemSpawnerMover extends ItemMod {
}
}
private boolean placeBlock(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
Block block = world.getBlock(x, y, z);
private boolean placeBlock(ItemStack itemstack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float xOffset, float yOffset, float zOffset) {
Block block = world.getBlockState(pos).getBlock();
if(block == Blocks.snow_layer)
side = 1;
else if(block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, x, y, z)) {
switch (side) {
case 0:
--y;
break;
case 1:
++y;
break;
case 2:
--z;
break;
case 3:
++z;
break;
case 4:
--x;
break;
case 5:
++x;
break;
}
side = EnumFacing.UP;
else if(block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, pos)) {
pos = pos.offset(side);
}
if(itemstack.stackSize == 0)
return false;
else if(!player.canPlayerEdit(x, y, z, side, itemstack))
else if(!player.canPlayerEdit(pos, side, itemstack))
return false;
else if(y == 255 && block.getMaterial().isSolid())
else if(pos.getY() == 255 && block.getMaterial().isSolid())
return false;
else if(world.canPlaceEntityOnSide(Blocks.mob_spawner, x, y, z, false, side, player, itemstack)) {
int meta = block.onBlockPlaced(world, x, y, z, side, xOffset, yOffset, zOffset, 0);
else if(world.canBlockBePlaced(Blocks.mob_spawner, pos, false, side, player, itemstack)) {
int meta = block.onBlockPlaced(world, pos, side, xOffset, yOffset, zOffset, 0);
if(placeBlockAt(itemstack, player, world, x, y, z, side, xOffset, yOffset, zOffset, meta)) {
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.func_150496_b(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if(placeBlockAt(itemstack, player, world, pos, side, xOffset, yOffset, zOffset, meta)) {
world.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getFrequency() * 0.8F);
player.renderBrokenItemStack(itemstack);
player.addStat(ModAchievements.spawnerMoverUse, 1);
for(int i = 0; i < 100; i++)
Botania.proxy.sparkleFX(world, x + Math.random(), y + Math.random(), z + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
Botania.proxy.sparkleFX(world, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6);
--itemstack.stackSize;
}
@@ -13,13 +13,15 @@ package vazkii.botania.common.item.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import vazkii.botania.api.BotaniaAPI;
@@ -41,28 +43,18 @@ public class ItemBlockSpecialFlower extends ItemBlockMod implements IRecipeKeyPr
}
@Override
public IIcon getIconIndex(ItemStack stack) {
return BotaniaAPI.getSignatureForName(getType(stack)).getIconForStack(stack);
}
@Override
public IIcon getIcon(ItemStack stack, int pass) {
return getIconIndex(stack);
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
boolean placed = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
if(placed) {
String type = getType(stack);
TileEntity te = world.getTileEntity(x, y, z);
TileEntity te = world.getTileEntity(pos);
if(te instanceof TileSpecialFlower) {
TileSpecialFlower tile = (TileSpecialFlower) te;
tile.setSubTile(type);
tile.onBlockAdded(world, x, y, z);
tile.onBlockPlacedBy(world, x, y, z, player, stack);
tile.onBlockAdded(world, pos, newState);
tile.onBlockPlacedBy(world, pos, newState, player, stack);
if(!world.isRemote)
world.markBlockForUpdate(x, y, z);
world.markBlockForUpdate(pos);
}
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.item.equipment.armor.terrasteel;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -66,11 +66,6 @@ public class ItemBaubleCosmetic extends ItemBauble implements ICosmeticBauble {
list.add(new ItemStack(item, 1, i));
}
@Override
public IIcon getIconFromDamage(int dmg) {
return icons[Math.min(SUBTYPES - 1, dmg)];
}
@Override
public String getUnlocalizedName(ItemStack par1ItemStack) {
return super.getUnlocalizedName(par1ItemStack) + par1ItemStack.getItemDamage();
@@ -23,7 +23,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.common.Botania;
@@ -45,7 +44,7 @@ public class LensPaint extends Lens {
dead = true;
} else {
Block block = entity.worldObj.getBlockState(pos.getBlockPos()).getBlock();
if(BotaniaAPI.paintableBlocks.contains(block)) {
if(BotaniaAPI.paintableBlocks.containsKey(block)) {
IBlockState state = entity.worldObj.getBlockState(pos.getBlockPos());
List<BlockPos> coordsToPaint = new ArrayList();
List<BlockPos> coordsFound = new ArrayList();
@@ -72,9 +71,9 @@ public class LensPaint extends Lens {
EnumDyeColor placeColor = EnumDyeColor.byMetadata(storedColor == 16 ? entity.worldObj.rand.nextInt(16) : storedColor);
IBlockState stateThere = entity.worldObj.getBlockState(coords);
if(metaThere != placeColor) {
if(stateThere.getValue(BotaniaAPI.paintableBlocks.get(block)) != placeColor) {
if(!entity.worldObj.isRemote)
entity.worldObj.setBlockState(coords, placeColor, 2);
entity.worldObj.setBlockState(coords, stateThere.withProperty(BotaniaAPI.paintableBlocks.get(block), placeColor), 2);
int hex = placeColor.getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
@@ -43,12 +43,6 @@ public class ItemModRecord extends ItemRecord {
return super.getUnlocalizedNameInefficiently(par1ItemStack).replaceAll("item\\.", "item." + LibResources.PREFIX_MOD);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = IconHelper.forItem(par1IconRegister, this);
}
@Override
public ResourceLocation getRecordResource(String name) {
return new ResourceLocation(file);
@@ -24,6 +24,7 @@ import net.minecraft.stats.Achievement;
import net.minecraft.util.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.item.ItemTossEvent;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
@@ -40,6 +41,7 @@ import com.google.common.collect.Multimap;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import vazkii.botania.common.lib.LibObfuscation;
public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, ICraftAchievement {
@@ -67,8 +69,18 @@ public class ItemAesirRing extends ItemRelicBauble implements IExtendedWireframe
entity.motionX = event.entityItem.motionX;
entity.motionY = event.entityItem.motionY;
entity.motionZ = event.entityItem.motionZ;
entity.age = event.entityItem.age;
entity.delayBeforeCanPickup = event.entityItem.delayBeforeCanPickup;
ObfuscationReflectionHelper.setPrivateValue(
EntityItem.class,
entity,
ObfuscationReflectionHelper.getPrivateValue(EntityItem.class, event.entityItem, LibObfuscation.AGE),
LibObfuscation.AGE
);
ObfuscationReflectionHelper.setPrivateValue(
EntityItem.class,
entity,
ObfuscationReflectionHelper.getPrivateValue(EntityItem.class, event.entityItem, LibObfuscation.PICKUP_DELAY),
LibObfuscation.PICKUP_DELAY
);
entity.worldObj.spawnEntityInWorld(entity);
}
}
@@ -16,6 +16,7 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
@@ -6,11 +6,11 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.oredict.OreDictionary;
@@ -75,7 +75,7 @@ public class PageElvenRecipe extends PageRecipe {
IIcon portalIcon = BlockAlfPortal.portalTex;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
RenderItem.getInstance().renderIcon(gui.getLeft() + 22, gui.getTop() + 36, portalIcon, 48, 48);
Minecraft.getMinecraft().getRenderItem().renderIcon(gui.getLeft() + 22, gui.getTop() + 36, portalIcon, 48, 48);
}
@SideOnly(Side.CLIENT)
@@ -12,6 +12,7 @@ package vazkii.botania.common.lexicon.page;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
@@ -12,6 +12,7 @@ package vazkii.botania.common.lexicon.page;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@@ -17,6 +17,7 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -17,6 +17,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.init.Blocks;
@@ -16,6 +16,7 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -137,7 +137,7 @@ public class PageRecipe extends LexiconPage {
@SideOnly(Side.CLIENT)
public void renderItem(IGuiLexiconEntry gui, double xPos, double yPos, ItemStack stack, boolean accountForContainer) {
RenderItem render = Minecraft.getMinecraft().getRenderManager();
RenderItem render = Minecraft.getMinecraft().getRenderItem();
boolean mouseDown = Mouse.isButtonDown(0);
GlStateManager.pushMatrix();
@@ -149,7 +149,7 @@ public class PageRecipe extends LexiconPage {
GlStateManager.pushMatrix();
GlStateManager.translate(xPos, yPos, 0);
render.renderItemAndEffectIntoGUI(stack, 0, 0);
render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, stack, 0, 0);
render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, stack, 0, 0, "");
GlStateManager.popMatrix();
RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix();
@@ -14,6 +14,7 @@ import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
@@ -124,7 +124,7 @@ public class PageShedding extends PageEntity {
GlStateManager.enableRescaleNormal();
GlStateManager.enableDepth();
render.renderItemAndEffectIntoGUI(stack, xPos, yPos);
render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, stack, xPos, yPos);
render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, stack, xPos, yPos, "");
RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix();
@@ -16,6 +16,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -12,6 +12,10 @@ package vazkii.botania.common.lib;
public final class LibObfuscation {
// EntityItem
public static final String[] AGE = { "age", "field_70292_b", "c" };
public static final String[] PICKUP_DELAY = { "delayBeforeCanPickup", "field_145804_b", "d" };
// EffectRenderer
public static final String[] PARTICLE_TEXTURES = new String[] { "particleTextures", "field_110737_b", "b" };