Decor and subtile

This commit is contained in:
Vincent Lee committed 2017-01-05 01:16:13 -06:00
1 parent a8558ea9a1
commit 3552154c24
12 files changed
+36 -33

No files matched your search

@@ -175,8 +175,9 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) {
if(stack != null) {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty()) {
IFloatingFlower flower = (IFloatingFlower) world.getTileEntity(pos);
IslandType type = null;
if(stack.getItem() == Items.SNOWBALL)
@@ -194,7 +195,7 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
}
if(!player.capabilities.isCreativeMode)
stack.stackSize--;
stack.shrink(1);
return true;
}
}
@@ -92,16 +92,17 @@ public class BlockManaFlame extends BlockMod implements ILexiconable {
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos) {
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
return NULL_AABB;
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing s, float xs, float ys, float zs) {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
if(WorldTypeSkyblock.isWorldSkyblock(world)) {
if(stack != null && stack.getItem() == Item.getItemFromBlock(Blocks.SAPLING) && !player.inventory.hasItemStack(new ItemStack(ModItems.lexicon))) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty() && stack.getItem() == Item.getItemFromBlock(Blocks.SAPLING) && !player.inventory.hasItemStack(new ItemStack(ModItems.lexicon))) {
if(!world.isRemote)
stack.stackSize--;
stack.shrink(1);
if(!player.inventory.addItemStackToInventory(new ItemStack(ModItems.lexicon)))
player.dropItem(new ItemStack(ModItems.lexicon), false);
return true;
@@ -112,10 +112,10 @@ public class BlockTinyPotato extends BlockMod implements ILexiconable {
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileTinyPotato) {
((TileTinyPotato) tile).interact(player, hand, stack, par6);
((TileTinyPotato) tile).interact(player, hand, player.getHeldItem(hand), par6);
player.addStat(ModAchievements.tinyPotatoPet, 1);
world.spawnParticle(EnumParticleTypes.HEART, pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), pos.getY() + AABB.maxY, pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0, 0 ,0);
}
@@ -61,7 +61,7 @@ public class SubTileBellethorn extends SubTileFunctional {
if(entity instanceof EntityWitch)
dmg = 20;
entity.attackEntityFrom(DamageSource.magic, dmg);
entity.attackEntityFrom(DamageSource.MAGIC, dmg);
mana -= manaToUse;
break;
}
@@ -85,21 +85,21 @@ public class SubTileExoflame extends SubTileFunctional {
}
public static boolean canFurnaceSmelt(TileEntityFurnace furnace){
if(furnace.getStackInSlot(0) == null)
if(furnace.getStackInSlot(0).isEmpty())
return false;
else {
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(furnace.getStackInSlot(0));
if(itemstack == null)
if(itemstack.isEmpty())
return false;
if(furnace.getStackInSlot(2) == null)
if(furnace.getStackInSlot(2).isEmpty())
return true;
if(!furnace.getStackInSlot(2).isItemEqual(itemstack))
return false;
int result = furnace.getStackInSlot(2).stackSize + itemstack.stackSize;
int result = furnace.getStackInSlot(2).getCount() + itemstack.getCount();
return result <= 64 && result <= itemstack.getMaxStackSize();
}
}
@@ -94,7 +94,7 @@ public class SubTileHopperhock extends SubTileFunctional {
boolean canAccept = canAcceptItem(stack, filter, filterType);
ItemStack simulate = ItemHandlerHelper.insertItem(inv.handler, stack.copy(), true);
int availablePut = stack.stackSize - (simulate == null ? 0 : simulate.stackSize);
int availablePut = stack.getAnimationsToGo() - (simulate.isEmpty() ? 0 : simulate.getCount());
canAccept &= availablePut > 0;
@@ -117,7 +117,7 @@ public class SubTileHopperhock extends SubTileFunctional {
SubTileSpectranthemum.spawnExplosionParticles(item, 3);
ItemHandlerHelper.insertItem(invToPutItemIn, stack.splitStack(amountToPutIn), false);
item.setEntityItemStack(stack); // Just in case someone subclasses EntityItem and changes something important.
if(item.getEntityItem().stackSize == 0)
if(item.getEntityItem().isEmpty())
item.setDead();
pulledAny = true;
}
@@ -23,12 +23,12 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCaveSpider;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityHusk;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.entity.monster.EntityStray;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.SkeletonType;
import net.minecraft.entity.monster.ZombieType;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -89,7 +89,7 @@ public class SubTileLoonuim extends SubTileFunctional {
pos = pos.up();
if(pos.getY() >= 254)
return;
} while(world.getBlockState(pos).getBlock().causesSuffocation());
} while(world.getBlockState(pos).causesSuffocation());
pos = pos.up();
double x = pos.getX() + Math.random();
@@ -108,12 +108,12 @@ public class SubTileLoonuim extends SubTileFunctional {
case 0:
entity = new EntityZombie(world);
if(world.rand.nextInt(10) == 0)
((EntityZombie) entity).setZombieType(ZombieType.HUSK);
entity = new EntityHusk(world);
break;
case 1:
entity = new EntitySkeleton(world);
if(world.rand.nextInt(10) == 0)
((EntitySkeleton) entity).setSkeletonType(SkeletonType.STRAY);
entity = new EntityStray(world);
break;
case 2:
if(world.rand.nextInt(10) == 0)
@@ -191,7 +191,7 @@ public class SubTileLoonuim extends SubTileFunctional {
EntityLivingBase e = event.getEntityLiving();
if(e.getEntityData().hasKey(TAG_ITEMSTACK_TO_DROP)) {
NBTTagCompound cmp = e.getEntityData().getCompoundTag(TAG_ITEMSTACK_TO_DROP);
ItemStack stack = ItemStack.loadItemStackFromNBT(cmp);
ItemStack stack = new ItemStack(cmp);
event.getDrops().clear();
event.getDrops().add(new EntityItem(e.world, e.posX, e.posY, e.posZ, stack));
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.subtile.functional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import gnu.trove.list.array.TIntArrayList;
import net.minecraft.block.Block;
@@ -75,7 +76,7 @@ public class SubTileMarimorphosis extends SubTileFunctional {
}
public ItemStack getStoneToPut(BlockPos coords) {
List<Type> types = Arrays.asList(BiomeDictionary.getTypesForBiome(supertile.getWorld().getBiome(coords)));
Set<Type> types = BiomeDictionary.getTypes(supertile.getWorld().getBiome(coords));
TIntArrayList values = new TIntArrayList();
for(int i = 0; i < 8; i++) {
@@ -57,8 +57,8 @@ public class SubTilePollidisiac extends SubTileFunctional {
ItemStack stack = item.getEntityItem();
if(animal.isBreedingItem(stack)) {
stack.stackSize--;
if(stack.stackSize == 0)
stack.shrink(1);
if(stack.isEmpty())
item.setDead();
mana -= manaCost;
@@ -140,8 +140,8 @@ public class SubTileRannuncarpus extends SubTileFunctional {
if(stackItem instanceof IFlowerPlaceable)
((IFlowerPlaceable) stackItem).onBlockPlacedByFlower(stack, this, coords);
stack.stackSize--;
if(stack.stackSize <= 0)
stack.shrink(1);
if(stack.isEmpty())
item.setDead();
if(mana > 1)
@@ -71,12 +71,12 @@ public class SubTileSpectranthemum extends SubTileFunctional {
continue;
ItemStack stack = item.getEntityItem();
if(stack != null) {
if(!stack.isEmpty()) {
Item sitem = stack.getItem();
if(sitem instanceof IManaItem)
continue;
int cost = stack.stackSize * COST;
int cost = stack.getCount() * COST;
if(mana >= cost) {
spawnExplosionParticles(item, 10);
item.setPosition(bindPos.getX() + 0.5, bindPos.getY() + 1.5, bindPos.getZ() + 0.5);
@@ -61,15 +61,15 @@ public class SubTileEndoflame extends SubTileGenerating {
if(stack.getItem().hasContainerItem(stack))
continue;
int burnTime = stack == null || stack.getItem() == Item.getItemFromBlock(ModBlocks.spreader) ? 0 : TileEntityFurnace.getItemBurnTime(stack);
if(burnTime > 0 && stack.stackSize > 0) {
int burnTime = stack .isEmpty() || stack.getItem() == Item.getItemFromBlock(ModBlocks.spreader) ? 0 : TileEntityFurnace.getItemBurnTime(stack);
if(burnTime > 0 && stack.getCount() > 0) {
this.burnTime = Math.min(FUEL_CAP, burnTime) / 2;
if(!supertile.getWorld().isRemote) {
stack.stackSize--;
stack.shrink(1);
supertile.getWorld().playSound(null, supertile.getPos(), BotaniaSoundEvents.endoflame, SoundCategory.BLOCKS, 0.2F, 1F);
if(stack.stackSize == 0)
if(stack.isEmpty())
item.setDead();
didSomething = true;