mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 14:59:22 +01:00
automatic vazkii thing
This commit is contained in:
parent
0f57eb80dc
commit
e482356563
155 changed files with 1478 additions and 1481 deletions
|
@ -7,23 +7,23 @@ import de.ellpeck.naturesaura.chunk.AuraChunk;
|
|||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -31,13 +31,13 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.ChunkProviderServer;
|
||||
import net.minecraft.world.chunk.AbstractChunkProvider;
|
||||
import net.minecraft.world.chunk.ServerChunkProvider;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -85,10 +85,10 @@ public final class Helper {
|
|||
world.profiler.endSection();
|
||||
}
|
||||
|
||||
public static List<EntityItemFrame> getAttachedItemFrames(World world, BlockPos pos) {
|
||||
List<EntityItemFrame> frames = world.getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB(pos).grow(0.25));
|
||||
public static List<ItemFrameEntity> getAttachedItemFrames(World world, BlockPos pos) {
|
||||
List<ItemFrameEntity> frames = world.getEntitiesWithinAABB(ItemFrameEntity.class, new AxisAlignedBB(pos).grow(0.25));
|
||||
for (int i = frames.size() - 1; i >= 0; i--) {
|
||||
EntityItemFrame frame = frames.get(i);
|
||||
ItemFrameEntity frame = frames.get(i);
|
||||
BlockPos framePos = frame.getHangingPosition().offset(frame.facingDirection.getOpposite());
|
||||
if (!pos.equals(framePos))
|
||||
frames.remove(i);
|
||||
|
@ -99,9 +99,9 @@ public final class Helper {
|
|||
// For some reason this method isn't public in World, but I also don't want to have to make a new BlockPos
|
||||
// or use the messy MutableBlockPos system just to see if a chunk is loaded, so this will have to do I guess
|
||||
public static boolean isChunkLoaded(World world, int x, int z) {
|
||||
IChunkProvider provider = world.getChunkProvider();
|
||||
if (provider instanceof ChunkProviderServer)
|
||||
return ((ChunkProviderServer) provider).chunkExists(x, z);
|
||||
AbstractChunkProvider provider = world.getChunkProvider();
|
||||
if (provider instanceof ServerChunkProvider)
|
||||
return ((ServerChunkProvider) provider).chunkExists(x, z);
|
||||
else
|
||||
return !provider.provideChunk(x, z).isEmpty();
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public final class Helper {
|
|||
return !nbt || ItemStack.areItemStackShareTagsEqual(first, second);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderItemInWorld(ItemStack stack) {
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
|
@ -135,7 +135,7 @@ public final class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderItemInGui(ItemStack stack, int x, int y, float scale) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
|
@ -151,7 +151,7 @@ public final class Helper {
|
|||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public static boolean putStackOnTile(EntityPlayer player, EnumHand hand, BlockPos pos, int slot, boolean sound) {
|
||||
public static boolean putStackOnTile(PlayerEntity player, Hand hand, BlockPos pos, int slot, boolean sound) {
|
||||
TileEntity tile = player.world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl) {
|
||||
IItemHandlerModifiable handler = ((TileEntityImpl) tile).getItemHandler(null);
|
||||
|
@ -176,7 +176,7 @@ public final class Helper {
|
|||
if (!player.world.isRemote) {
|
||||
ItemStack stack = handler.getStackInSlot(slot);
|
||||
if (!player.addItemStackToInventory(stack)) {
|
||||
EntityItem item = new EntityItem(player.world, player.posX, player.posY, player.posZ, stack);
|
||||
ItemEntity item = new ItemEntity(player.world, player.posX, player.posY, player.posZ, stack);
|
||||
player.world.spawnEntity(item);
|
||||
}
|
||||
handler.setStackInSlot(slot, ItemStack.EMPTY);
|
||||
|
@ -203,28 +203,28 @@ public final class Helper {
|
|||
};
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) {
|
||||
return capability == NaturesAuraAPI.capAuraRecharge;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
|
||||
return capability == NaturesAuraAPI.capAuraRecharge ? (T) this.recharge : null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static IBlockState getStateFromString(String raw) {
|
||||
public static BlockState getStateFromString(String raw) {
|
||||
String[] split = raw.split("\\[");
|
||||
Block block = Block.REGISTRY.getObject(new ResourceLocation(split[0]));
|
||||
if (block != null) {
|
||||
IBlockState state = block.getDefaultState();
|
||||
BlockState state = block.getDefaultState();
|
||||
if (split.length > 1) {
|
||||
for (String part : split[1].replace("]", "").split(",")) {
|
||||
String[] keyValue = part.split("=");
|
||||
for (IProperty<?> prop : state.getProperties().keySet()) {
|
||||
IBlockState changed = findProperty(state, prop, keyValue[0], keyValue[1]);
|
||||
BlockState changed = findProperty(state, prop, keyValue[0], keyValue[1]);
|
||||
if (changed != null) {
|
||||
state = changed;
|
||||
break;
|
||||
|
@ -237,7 +237,7 @@ public final class Helper {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static <T extends Comparable<T>> IBlockState findProperty(IBlockState state, IProperty<T> prop, String key, String newValue) {
|
||||
private static <T extends Comparable<T>> BlockState findProperty(BlockState state, IProperty<T> prop, String key, String newValue) {
|
||||
if (key.equals(prop.getName()))
|
||||
for (T value : prop.getAllowedValues())
|
||||
if (prop.getName(value).equals(newValue))
|
||||
|
@ -249,21 +249,21 @@ public final class Helper {
|
|||
CapabilityManager.INSTANCE.register(type, new Capability.IStorage<T>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public NBTBase writeNBT(Capability capability, Object instance, EnumFacing side) {
|
||||
public NBTBase writeNBT(Capability capability, Object instance, Direction side) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(Capability capability, Object instance, EnumFacing side, NBTBase nbt) {
|
||||
public void readNBT(Capability capability, Object instance, Direction side, NBTBase nbt) {
|
||||
|
||||
}
|
||||
}, () -> null);
|
||||
}
|
||||
|
||||
public static void addAdvancement(EntityPlayer player, ResourceLocation advancement, String criterion) {
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
public static void addAdvancement(PlayerEntity player, ResourceLocation advancement, String criterion) {
|
||||
if (!(player instanceof ServerPlayerEntity))
|
||||
return;
|
||||
EntityPlayerMP playerMp = (EntityPlayerMP) player;
|
||||
ServerPlayerEntity playerMp = (ServerPlayerEntity) player;
|
||||
Advancement adv = playerMp.getServerWorld().getAdvancementManager().getAdvancement(advancement);
|
||||
if (adv != null)
|
||||
playerMp.getAdvancements().grantCriterion(adv, criterion);
|
||||
|
@ -277,7 +277,7 @@ public final class Helper {
|
|||
return highestAmount;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderWeirdBox(double x, double y, double z, double width, double height, double depth) {
|
||||
GL11.glVertex3d(x, y + height, z);
|
||||
GL11.glVertex3d(x + width, y + height, z);
|
||||
|
@ -305,8 +305,8 @@ public final class Helper {
|
|||
GL11.glVertex3d(x, y, z);
|
||||
}
|
||||
|
||||
public static boolean isHoldingItem(EntityPlayer player, Item item) {
|
||||
for (EnumHand hand : EnumHand.values()) {
|
||||
public static boolean isHoldingItem(PlayerEntity player, Item item) {
|
||||
for (Hand hand : Hand.values()) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (!stack.isEmpty() && stack.getItem() == item)
|
||||
return true;
|
||||
|
|
|
@ -9,7 +9,7 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
|
|||
import de.ellpeck.naturesaura.blocks.multi.Multiblock;
|
||||
import de.ellpeck.naturesaura.compat.Compat;
|
||||
import de.ellpeck.naturesaura.misc.WorldData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Tuple;
|
||||
|
@ -29,16 +29,16 @@ import java.util.function.BiConsumer;
|
|||
|
||||
public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
|
||||
@Override
|
||||
public boolean extractAuraFromPlayer(EntityPlayer player, int amount, boolean simulate) {
|
||||
public boolean extractAuraFromPlayer(PlayerEntity player, int amount, boolean simulate) {
|
||||
return this.auraPlayerInteraction(player, amount, true, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertAuraIntoPlayer(EntityPlayer player, int amount, boolean simulate) {
|
||||
public boolean insertAuraIntoPlayer(PlayerEntity player, int amount, boolean simulate) {
|
||||
return this.auraPlayerInteraction(player, amount, false, simulate);
|
||||
}
|
||||
|
||||
private boolean auraPlayerInteraction(EntityPlayer player, int amount, boolean extract, boolean simulate) {
|
||||
private boolean auraPlayerInteraction(PlayerEntity player, int amount, boolean extract, boolean simulate) {
|
||||
if (extract && player.capabilities.isCreativeMode)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
|||
import de.ellpeck.naturesaura.api.recipes.WeightedOre;
|
||||
import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.common.config.Config;
|
||||
import net.minecraftforge.common.config.Config.Comment;
|
||||
import net.minecraftforge.common.config.Config.RangeDouble;
|
||||
|
|
|
@ -20,8 +20,8 @@ import de.ellpeck.naturesaura.potion.ModPotions;
|
|||
import de.ellpeck.naturesaura.proxy.IProxy;
|
||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
@ -55,7 +55,7 @@ public final class NaturesAura {
|
|||
@SidedProxy(modId = MOD_ID, clientSide = PROXY_LOCATION + "ClientProxy", serverSide = PROXY_LOCATION + "ServerProxy")
|
||||
public static IProxy proxy;
|
||||
|
||||
public static final CreativeTabs CREATIVE_TAB = new CreativeTabs(MOD_ID) {
|
||||
public static final ItemGroup CREATIVE_TAB = new ItemGroup(MOD_ID) {
|
||||
@Override
|
||||
public ItemStack createIcon() {
|
||||
return new ItemStack(ModItems.GOLD_LEAF);
|
||||
|
|
|
@ -13,15 +13,15 @@ import de.ellpeck.naturesaura.api.misc.IWorldData;
|
|||
import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
|
||||
import de.ellpeck.naturesaura.api.multiblock.Matcher;
|
||||
import de.ellpeck.naturesaura.api.recipes.*;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.FlowerBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
@ -66,16 +66,16 @@ public final class NaturesAuraAPI {
|
|||
/**
|
||||
* The list of all types of blocks that several mechanics in the mod use as
|
||||
* flowers. Right now, this includes the Herbivorous Absorber and the
|
||||
* Offering Table. By default, all {@link BlockFlower} instances and all
|
||||
* Offering Table. By default, all {@link FlowerBlock} instances and all
|
||||
* blocks specified in the config file are added
|
||||
*/
|
||||
public static final List<IBlockState> FLOWERS = new ArrayList<>();
|
||||
public static final List<BlockState> FLOWERS = new ArrayList<>();
|
||||
/**
|
||||
* A map of all of the block states that the Botanist's Pickaxe can convert
|
||||
* into their mossy variations. Contains mossy brick and mossy cobblestone
|
||||
* by default, along with all blocks specified in the config file
|
||||
*/
|
||||
public static final BiMap<IBlockState, IBlockState> BOTANIST_PICKAXE_CONVERSIONS = HashBiMap.create();
|
||||
public static final BiMap<BlockState, BlockState> BOTANIST_PICKAXE_CONVERSIONS = HashBiMap.create();
|
||||
/**
|
||||
* A map of all {@link IAuraType} instances which are types of Aura present
|
||||
* in different types of worlds. {@link BasicAuraType} instances can be
|
||||
|
@ -201,7 +201,7 @@ public final class NaturesAuraAPI {
|
|||
* @param simulate If the extraction should be simulated
|
||||
* @return If the extraction was successful
|
||||
*/
|
||||
boolean extractAuraFromPlayer(EntityPlayer player, int amount, boolean simulate);
|
||||
boolean extractAuraFromPlayer(PlayerEntity player, int amount, boolean simulate);
|
||||
|
||||
/**
|
||||
* Helper method to insert aura into an {@link IAuraContainer} in the
|
||||
|
@ -213,7 +213,7 @@ public final class NaturesAuraAPI {
|
|||
* @param simulate If the insertion should be simulated
|
||||
* @return If the insertion was successful
|
||||
*/
|
||||
boolean insertAuraIntoPlayer(EntityPlayer player, int amount, boolean simulate);
|
||||
boolean insertAuraIntoPlayer(PlayerEntity player, int amount, boolean simulate);
|
||||
|
||||
/**
|
||||
* This method can be used to spawn the magic particle effect used by
|
||||
|
@ -285,7 +285,7 @@ public final class NaturesAuraAPI {
|
|||
* each character is mapped to a raw matcher
|
||||
* @param rawMatchers Each char matcher in the form of the char followed
|
||||
* by a matcher, either in the form of a Block, an
|
||||
* IBlockState or a {@link Matcher}, similar to the
|
||||
* BlockState or a {@link Matcher}, similar to the
|
||||
* old way that crafting recipes work.
|
||||
* @return the multiblock instance
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.aura.chunk;
|
|||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
@ -18,7 +18,7 @@ import java.util.function.BiConsumer;
|
|||
* It is not intended for API users to create custom implementation of this
|
||||
* class.
|
||||
*/
|
||||
public interface IAuraChunk extends INBTSerializable<NBTTagCompound> {
|
||||
public interface IAuraChunk extends INBTSerializable<CompoundNBT> {
|
||||
/**
|
||||
* The default amount of Aura that a chunk has stored
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package de.ellpeck.naturesaura.api.aura.chunk;
|
||||
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -16,7 +16,7 @@ public interface IDrainSpotEffect {
|
|||
|
||||
ResourceLocation getName();
|
||||
|
||||
default int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
default int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package de.ellpeck.naturesaura.api.aura.container;
|
||||
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
public class BasicAuraContainer implements IAuraContainer {
|
||||
|
||||
|
@ -52,11 +52,11 @@ public class BasicAuraContainer implements IAuraContainer {
|
|||
return this.type == null || type.isSimilar(this.type);
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound compound) {
|
||||
public void writeNBT(CompoundNBT compound) {
|
||||
compound.setInteger("aura", this.aura);
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound compound) {
|
||||
public void readNBT(CompoundNBT compound) {
|
||||
this.aura = compound.getInteger("aura");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.aura.container;
|
|||
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
|
||||
public class ItemAuraContainer implements IAuraContainer {
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class ItemAuraContainer implements IAuraContainer {
|
|||
|
||||
private void setAura(int amount) {
|
||||
if (!this.stack.hasTagCompound()) {
|
||||
this.stack.setTagCompound(new NBTTagCompound());
|
||||
this.stack.setTagCompound(new CompoundNBT());
|
||||
}
|
||||
this.stack.getTagCompound().setInteger("aura", amount);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.aura.type;
|
|||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.api.internal;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -17,12 +17,12 @@ import java.util.function.BiConsumer;
|
|||
|
||||
public class StubHooks implements NaturesAuraAPI.IInternalHooks {
|
||||
@Override
|
||||
public boolean extractAuraFromPlayer(EntityPlayer player, int amount, boolean simulate) {
|
||||
public boolean extractAuraFromPlayer(PlayerEntity player, int amount, boolean simulate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertAuraIntoPlayer(EntityPlayer player, int amount, boolean simulate) {
|
||||
public boolean insertAuraIntoPlayer(PlayerEntity player, int amount, boolean simulate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package de.ellpeck.naturesaura.api.misc;
|
||||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.common.util.INBTSerializable;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
public interface IWorldData extends ICapabilityProvider, INBTSerializable<NBTTagCompound> {
|
||||
public interface IWorldData extends ICapabilityProvider, INBTSerializable<CompoundNBT> {
|
||||
|
||||
static IWorldData getWorldData(World world) {
|
||||
if (world.hasCapability(NaturesAuraAPI.capWorldData, null))
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package de.ellpeck.naturesaura.api.multiblock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -13,15 +13,15 @@ import java.util.List;
|
|||
|
||||
public class Matcher {
|
||||
|
||||
private final IBlockState defaultState;
|
||||
private final BlockState defaultState;
|
||||
private final ICheck check;
|
||||
|
||||
public Matcher(IBlockState defaultState, ICheck check) {
|
||||
public Matcher(BlockState defaultState, ICheck check) {
|
||||
this.defaultState = defaultState;
|
||||
this.check = check;
|
||||
}
|
||||
|
||||
public IBlockState getDefaultState() {
|
||||
public BlockState getDefaultState() {
|
||||
return this.defaultState;
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,10 @@ public class Matcher {
|
|||
|
||||
public static Matcher oreDict(Block defaultBlock, String name) {
|
||||
return new Matcher(defaultBlock.getDefaultState(), new ICheck() {
|
||||
private List<IBlockState> states;
|
||||
private List<BlockState> states;
|
||||
|
||||
@Override
|
||||
public boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, IBlockState state, char c) {
|
||||
public boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c) {
|
||||
if (this.states == null) {
|
||||
this.states = new ArrayList<>();
|
||||
for (ItemStack stack : OreDictionary.getOres(name)) {
|
||||
|
@ -59,6 +59,6 @@ public class Matcher {
|
|||
}
|
||||
|
||||
public interface ICheck {
|
||||
boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, IBlockState state, char c);
|
||||
boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.recipes;
|
|||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.MobEntity;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -34,8 +34,8 @@ public class AnimalSpawnerRecipe {
|
|||
if (x == 0 && y == 0 && z == 0)
|
||||
return entity;
|
||||
entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360F), 0F);
|
||||
if (entity instanceof EntityLiving) {
|
||||
EntityLiving living = (EntityLiving) entity;
|
||||
if (entity instanceof MobEntity) {
|
||||
MobEntity living = (MobEntity) entity;
|
||||
living.rotationYawHead = entity.rotationYaw;
|
||||
living.renderYawOffset = entity.rotationYaw;
|
||||
living.onInitialSpawn(world.getDifficultyForLocation(living.getPosition()), null);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package de.ellpeck.naturesaura.api.render;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public interface ITrinketItem {
|
||||
enum RenderType {
|
||||
HEAD, BODY
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void render(ItemStack stack, EntityPlayer player, RenderType type, boolean isHolding);
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,14 +3,14 @@ package de.ellpeck.naturesaura.api.render;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public interface IVisualizable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
AxisAlignedBB getVisualizationBounds(World world, BlockPos pos);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
int getVisualizationColor(World world, BlockPos pos);
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAncientLeaves;
|
||||
import de.ellpeck.naturesaura.reg.*;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -23,15 +23,15 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAncientLeaves extends BlockLeaves implements
|
||||
public class BlockAncientLeaves extends LeavesBlock implements
|
||||
IModItem, ICreativeItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem, ITileEntityProvider {
|
||||
|
||||
public BlockAncientLeaves() {
|
||||
|
@ -40,8 +40,8 @@ public class BlockAncientLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return MapColor.PINK;
|
||||
public MaterialColor getMapColor(BlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return MaterialColor.PINK;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +75,7 @@ public class BlockAncientLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
boolean check = (meta & 1) != 0;
|
||||
boolean decay = (meta & 2) != 0;
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class BlockAncientLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
boolean check = state.getValue(CHECK_DECAY);
|
||||
boolean decay = state.getValue(DECAYABLE);
|
||||
|
||||
|
@ -91,14 +91,14 @@ public class BlockAncientLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) {
|
||||
public void beginLeavesDecay(BlockState state, World world, BlockPos pos) {
|
||||
if (!state.getValue(CHECK_DECAY) && state.getValue(DECAYABLE)) {
|
||||
world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||
public void breakBlock(World worldIn, BlockPos pos, BlockState state) {
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
@ -115,20 +115,20 @@ public class BlockAncientLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IBlockColor getBlockColor() {
|
||||
return (state, worldIn, pos, tintIndex) -> 0xE55B97;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, tintIndex) -> 0xE55B97;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
super.randomDisplayTick(stateIn, worldIn, pos, rand);
|
||||
if (rand.nextFloat() >= 0.95F && !worldIn.getBlockState(pos.down()).isFullBlock()) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
|
@ -147,12 +147,12 @@ public class BlockAncientLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
public Item getItemDropped(BlockState state, Random rand, int fortune) {
|
||||
return Item.getItemFromBlock(ModBlocks.ANCIENT_SAPLING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) {
|
||||
super.updateTick(worldIn, pos, state, rand);
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
|
|
|
@ -4,14 +4,14 @@ import de.ellpeck.naturesaura.reg.ICreativeItem;
|
|||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.LogBlock;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
public class BlockAncientLog extends BlockLog implements IModItem, ICreativeItem, IModelProvider {
|
||||
public class BlockAncientLog extends LogBlock implements IModItem, ICreativeItem, IModelProvider {
|
||||
|
||||
private final String baseName;
|
||||
|
||||
|
@ -46,12 +46,12 @@ public class BlockAncientLog extends BlockLog implements IModItem, ICreativeItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(LOG_AXIS).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(LOG_AXIS, EnumAxis.values()[meta]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ import de.ellpeck.naturesaura.reg.ICreativeItem;
|
|||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.BushBlock;
|
||||
import net.minecraft.block.SaplingBlock;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockAncientSapling extends BlockBush implements IGrowable, IModItem, ICreativeItem, IModelProvider {
|
||||
public class BlockAncientSapling extends BushBlock implements IGrowable, IModItem, ICreativeItem, IModelProvider {
|
||||
|
||||
private static final AxisAlignedBB AABB = new AxisAlignedBB(
|
||||
0.09999999403953552D, 0.0D, 0.09999999403953552D,
|
||||
|
@ -36,12 +36,12 @@ public class BlockAncientSapling extends BlockBush implements IGrowable, IModIte
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
public void updateTick(World world, BlockPos pos, BlockState state, Random rand) {
|
||||
if (!world.isRemote) {
|
||||
super.updateTick(world, pos, state, rand);
|
||||
|
||||
|
@ -72,34 +72,34 @@ public class BlockAncientSapling extends BlockBush implements IGrowable, IModIte
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(BlockSapling.STAGE, meta);
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(SaplingBlock.STAGE, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BlockSapling.STAGE);
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(SaplingBlock.STAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, BlockSapling.STAGE);
|
||||
return new BlockStateContainer(this, SaplingBlock.STAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGrow(World world, BlockPos pos, IBlockState state, boolean isClient) {
|
||||
public boolean canGrow(World world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseBonemeal(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
public boolean canUseBonemeal(World world, Random rand, BlockPos pos, BlockState state) {
|
||||
return world.rand.nextFloat() < 0.45F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void grow(World world, Random rand, BlockPos pos, IBlockState state) {
|
||||
if (state.getValue(BlockSapling.STAGE) == 0) {
|
||||
world.setBlockState(pos, state.cycleProperty(BlockSapling.STAGE), 4);
|
||||
public void grow(World world, Random rand, BlockPos pos, BlockState state) {
|
||||
if (state.getValue(SaplingBlock.STAGE) == 0) {
|
||||
world.setBlockState(pos, state.cycleProperty(SaplingBlock.STAGE), 4);
|
||||
} else if (TerrainGen.saplingGrowTree(world, rand, pos)) {
|
||||
new WorldGenAncientTree(true).generate(world, rand, pos);
|
||||
}
|
||||
|
|
|
@ -8,11 +8,11 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
|||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.INpc;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.INPC;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.passive.IAnimal;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -22,9 +22,9 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
|||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable {
|
||||
public BlockAnimalGenerator() {
|
||||
|
@ -37,18 +37,18 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
|
||||
@SubscribeEvent
|
||||
public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
if (entity.world.isRemote || !(entity instanceof IAnimals) || entity instanceof IMob || entity instanceof INpc)
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
if (entity.world.isRemote || !(entity instanceof IAnimal) || entity instanceof IMob || entity instanceof INPC)
|
||||
return;
|
||||
NBTTagCompound data = entity.getEntityData();
|
||||
CompoundNBT data = entity.getEntityData();
|
||||
int timeAlive = data.getInteger(NaturesAura.MOD_ID + ":time_alive");
|
||||
data.setInteger(NaturesAura.MOD_ID + ":time_alive", timeAlive + 1);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDeath(LivingDeathEvent event) {
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
if (entity.world.isRemote || !(entity instanceof IAnimals) || entity instanceof IMob || entity instanceof INpc)
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
if (entity.world.isRemote || !(entity instanceof IAnimal) || entity instanceof IMob || entity instanceof INPC)
|
||||
return;
|
||||
BlockPos pos = entity.getPosition();
|
||||
Helper.getTileEntitiesInArea(entity.world, pos, 5, tile -> {
|
||||
|
@ -56,7 +56,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
return false;
|
||||
TileEntityAnimalGenerator gen = (TileEntityAnimalGenerator) tile;
|
||||
|
||||
NBTTagCompound data = entity.getEntityData();
|
||||
CompoundNBT data = entity.getEntityData();
|
||||
data.setBoolean(NaturesAura.MOD_ID + ":no_drops", true);
|
||||
|
||||
if (gen.isBusy())
|
||||
|
@ -85,26 +85,26 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
|
||||
@SubscribeEvent
|
||||
public void onEntityDrops(LivingDropsEvent event) {
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
if (entity.getEntityData().getBoolean(NaturesAura.MOD_ID + ":no_drops"))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityExp(LivingExperienceDropEvent event) {
|
||||
EntityLivingBase entity = event.getEntityLiving();
|
||||
LivingEntity entity = event.getEntityLiving();
|
||||
if (entity.getEntityData().getBoolean(NaturesAura.MOD_ID + ":no_drops"))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return new AxisAlignedBB(pos).grow(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0x11377a;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks;
|
|||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraDetector;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -17,12 +17,12 @@ public class BlockAuraDetector extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityAuraDetector)
|
||||
return ((TileEntityAuraDetector) tile).redstonePower;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package de.ellpeck.naturesaura.blocks;
|
||||
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.HorizontalBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockAutoCrafter extends BlockContainerImpl {
|
||||
public static final PropertyDirection FACING = BlockHorizontal.FACING;
|
||||
public static final PropertyDirection FACING = HorizontalBlock.FACING;
|
||||
|
||||
public BlockAutoCrafter() {
|
||||
super(Material.WOOD, "auto_crafter", TileEntityAutoCrafter.class, "auto_crafter");
|
||||
|
@ -27,17 +27,17 @@ public class BlockAutoCrafter extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byHorizontalIndex(meta));
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(FACING, Direction.byHorizontalIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) {
|
||||
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityChunkLoader;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -19,8 +19,8 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
@ -42,7 +42,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityChunkLoader) {
|
||||
|
@ -61,8 +61,8 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityChunkLoader) {
|
||||
int range = ((TileEntityChunkLoader) tile).range();
|
||||
|
@ -75,33 +75,33 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0xc159f9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BOUND_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl
|
|||
@Override
|
||||
public void ticketsLoaded(List<Ticket> tickets, World world) {
|
||||
for (Ticket ticket : tickets) {
|
||||
NBTTagCompound data = ticket.getModData();
|
||||
CompoundNBT data = ticket.getModData();
|
||||
BlockPos pos = BlockPos.fromLong(data.getLong("pos"));
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityChunkLoader))
|
||||
|
|
|
@ -7,14 +7,14 @@ import de.ellpeck.naturesaura.reg.IModItem;
|
|||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.ContainerBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockContainerImpl extends BlockContainer implements IModItem, ICreativeItem, IModelProvider {
|
||||
public class BlockContainerImpl extends ContainerBlock implements IModItem, ICreativeItem, IModelProvider {
|
||||
|
||||
private final String baseName;
|
||||
|
||||
|
@ -75,12 +75,12 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||
public void breakBlock(World worldIn, BlockPos pos, BlockState state) {
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl)
|
||||
|
@ -90,7 +90,7 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl)
|
||||
drops.add(((TileEntityImpl) tile).getDrop(state, fortune));
|
||||
|
@ -99,30 +99,30 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) {
|
||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
super.harvestBlock(worldIn, player, pos, state, te, stack);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl)
|
||||
((TileEntityImpl) tile).loadDataOnPlace(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, BlockState state) {
|
||||
this.updateRedstoneState(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
this.updateRedstoneState(worldIn, pos);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) {
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl) {
|
||||
|
|
|
@ -2,14 +2,14 @@ package de.ellpeck.naturesaura.blocks;
|
|||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -24,25 +24,25 @@ public class BlockDecayedLeaves extends BlockImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random random) {
|
||||
public void updateTick(World worldIn, BlockPos pos, BlockState state, Random random) {
|
||||
if (!worldIn.isRemote) {
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
public Item getItemDropped(BlockState state, Random rand, int fortune) {
|
||||
return Items.AIR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,31 +9,31 @@ import de.ellpeck.naturesaura.reg.ICreativeItem;
|
|||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.block.AbstractRailBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
public class BlockDimensionRail extends BlockRailBase implements IModItem, ICreativeItem, IModelProvider {
|
||||
public class BlockDimensionRail extends AbstractRailBlock implements IModItem, ICreativeItem, IModelProvider {
|
||||
|
||||
public static final PropertyEnum<EnumRailDirection> SHAPE = PropertyEnum.create("shape", EnumRailDirection.class, EnumRailDirection.NORTH_SOUTH, EnumRailDirection.EAST_WEST);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = playerIn.getHeldItem(hand);
|
||||
if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
|
||||
if (!worldIn.isRemote) {
|
||||
|
@ -74,7 +74,7 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onMinecartPass(World world, EntityMinecart cart, BlockPos pos) {
|
||||
public void onMinecartPass(World world, AbstractMinecartEntity cart, BlockPos pos) {
|
||||
if (world.isRemote)
|
||||
return;
|
||||
if (cart.isBeingRidden())
|
||||
|
@ -103,7 +103,7 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea
|
|||
return new BlockPos(pos.getX() / 8, pos.getY() / 2, pos.getZ() / 8);
|
||||
} else if (this == ModBlocks.DIMENSION_RAIL_END) {
|
||||
// travel to the end from the overworld
|
||||
WorldServer end = server.getWorld(this.goalDim);
|
||||
ServerWorld end = server.getWorld(this.goalDim);
|
||||
return end.getSpawnCoordinate().up(8);
|
||||
} else {
|
||||
if (world.provider.getDimensionType() == DimensionType.NETHER) {
|
||||
|
@ -138,12 +138,12 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(SHAPE).getMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(SHAPE, EnumRailDirection.byMetadata(meta));
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,14 @@ import de.ellpeck.naturesaura.reg.ICreativeItem;
|
|||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BushBlock;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.boss.dragon.EnderDragonEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -26,12 +26,12 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
|||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem, IModelProvider, ITileEntityProvider {
|
||||
public class BlockEndFlower extends BushBlock implements IModItem, ICreativeItem, IModelProvider, ITileEntityProvider {
|
||||
|
||||
public BlockEndFlower() {
|
||||
this.setHardness(0.5F);
|
||||
|
@ -44,10 +44,10 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem
|
|||
|
||||
@SubscribeEvent
|
||||
public void onDraonTick(LivingUpdateEvent event) {
|
||||
EntityLivingBase living = event.getEntityLiving();
|
||||
if (living.world.isRemote || !(living instanceof EntityDragon))
|
||||
LivingEntity living = event.getEntityLiving();
|
||||
if (living.world.isRemote || !(living instanceof EnderDragonEntity))
|
||||
return;
|
||||
EntityDragon dragon = (EntityDragon) living;
|
||||
EnderDragonEntity dragon = (EnderDragonEntity) living;
|
||||
if (dragon.deathTicks < 150 || dragon.deathTicks % 10 != 0)
|
||||
return;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSustainBush(IBlockState state) {
|
||||
protected boolean canSustainBush(BlockState state) {
|
||||
return state.getBlock() == Blocks.END_STONE;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) {
|
||||
public boolean canBlockStay(World worldIn, BlockPos pos, BlockState state) {
|
||||
return this.canSustainBush(worldIn.getBlockState(pos.down()));
|
||||
}
|
||||
|
||||
|
@ -105,13 +105,13 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||
public void breakBlock(World worldIn, BlockPos pos, BlockState state) {
|
||||
super.breakBlock(worldIn, pos, state);
|
||||
worldIn.removeTileEntity(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityEndFlower && ((TileEntityEndFlower) tile).isDrainMode)
|
||||
return;
|
||||
|
@ -120,12 +120,12 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) {
|
||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
super.harvestBlock(worldIn, player, pos, state, te, stack);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
|
|
|
@ -6,21 +6,21 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
|||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.block.BlockAnvil;
|
||||
import net.minecraft.block.AnvilBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -29,9 +29,9 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
@ -55,11 +55,11 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
public static String getEnderName(ItemStack stack) {
|
||||
if (!stack.hasTagCompound())
|
||||
return "";
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
CompoundNBT compound = stack.getTagCompound();
|
||||
return compound.getString(NaturesAura.MOD_ID + ":ender_name");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void addEnderNameInfo(ItemStack stack, List<String> tooltip) {
|
||||
String name = getEnderName(stack);
|
||||
if (name != null && !name.isEmpty())
|
||||
|
@ -73,8 +73,8 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
public void onRightClick(PlayerInteractEvent.RightClickBlock event) {
|
||||
World world = event.getWorld();
|
||||
BlockPos pos = event.getPos();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() instanceof BlockAnvil) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock() instanceof AnvilBlock) {
|
||||
CACHED_WORLD.set(new WeakReference<>(world));
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
return;
|
||||
ItemStack output = stack.copy();
|
||||
if (!output.hasTagCompound())
|
||||
output.setTagCompound(new NBTTagCompound());
|
||||
output.setTagCompound(new CompoundNBT());
|
||||
output.getTagCompound().setString(NaturesAura.MOD_ID + ":ender_name", name);
|
||||
event.setOutput(output);
|
||||
event.setMaterialCost(stack.getCount());
|
||||
|
@ -105,7 +105,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityEnderCrate) {
|
||||
|
@ -120,14 +120,14 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
addEnderNameInfo(stack, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
int j = rand.nextInt(2) * 2 - 1;
|
||||
int k = rand.nextInt(2) * 2 - 1;
|
||||
|
@ -142,8 +142,8 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Tuple<Class, TileEntitySpecialRenderer> getTESR() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityEnderCrate.class, new RenderEnderCrate());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,19 +6,19 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -30,12 +30,12 @@ public class BlockFieldCreator extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFieldCreator) {
|
||||
if (!worldIn.isRemote) {
|
||||
String key = NaturesAura.MOD_ID + ":field_creator_pos";
|
||||
NBTTagCompound compound = playerIn.getEntityData();
|
||||
CompoundNBT compound = playerIn.getEntityData();
|
||||
if (!playerIn.isSneaking() && compound.hasKey(key)) {
|
||||
BlockPos stored = BlockPos.fromLong(compound.getLong(key));
|
||||
TileEntityFieldCreator creator = (TileEntityFieldCreator) tile;
|
||||
|
@ -53,16 +53,16 @@ public class BlockFieldCreator extends BlockContainerImpl {
|
|||
otherCreator.sendToClients();
|
||||
|
||||
compound.removeTag(key);
|
||||
playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".connected"), true);
|
||||
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".connected"), true);
|
||||
} else
|
||||
playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".stored_pos_gone"), true);
|
||||
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos_gone"), true);
|
||||
} else
|
||||
playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".too_far"), true);
|
||||
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".too_far"), true);
|
||||
} else
|
||||
playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".same_position"), true);
|
||||
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".same_position"), true);
|
||||
} else {
|
||||
compound.setLong(key, pos.toLong());
|
||||
playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".stored_pos"), true);
|
||||
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos"), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -71,8 +71,8 @@ public class BlockFieldCreator extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFieldCreator) {
|
||||
TileEntityFieldCreator creator = (TileEntityFieldCreator) tile;
|
||||
|
@ -93,33 +93,33 @@ public class BlockFieldCreator extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable {
|
||||
public BlockFireworkGenerator() {
|
||||
|
@ -18,13 +18,13 @@ public class BlockFireworkGenerator extends BlockContainerImpl implements IVisua
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return new AxisAlignedBB(pos).grow(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0xa442f4;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable {
|
||||
|
||||
|
@ -19,13 +19,13 @@ public class BlockFlowerGenerator extends BlockContainerImpl implements IVisuali
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return new AxisAlignedBB(pos).grow(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0xffed2b;
|
||||
}
|
||||
|
|
|
@ -6,17 +6,17 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -37,20 +37,20 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFurnaceHeater && ((TileEntityFurnaceHeater) tile).isActive) {
|
||||
EnumFacing facing = stateIn.getValue(FACING);
|
||||
Direction facing = stateIn.getValue(FACING);
|
||||
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
if (facing == EnumFacing.UP) {
|
||||
if (facing == Direction.UP) {
|
||||
x = 0.35F + rand.nextFloat() * 0.3F;
|
||||
y = 0F;
|
||||
z = 0.35F + rand.nextFloat() * 0.3F;
|
||||
} else if (facing == EnumFacing.DOWN) {
|
||||
} else if (facing == Direction.DOWN) {
|
||||
x = 0.35F + rand.nextFloat() * 0.3F;
|
||||
y = 1F;
|
||||
z = 0.35F + rand.nextFloat() * 0.3F;
|
||||
|
@ -70,7 +70,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
switch (state.getValue(FACING)) {
|
||||
case DOWN:
|
||||
return AABB_DOWN;
|
||||
|
@ -88,27 +88,27 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
|
@ -118,17 +118,17 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(FACING, Direction.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
public BlockState getStateForPlacement(World world, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer, Hand hand) {
|
||||
return this.getDefaultState().withProperty(FACING, facing);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover;
|
|||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
|
@ -19,8 +19,8 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Tuple<Class, TileEntitySpecialRenderer> getTESR() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityGeneratorLimitRemover.class, new RenderGeneratorLimitRemover());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,18 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -74,11 +74,11 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABBS[getAABBIndex(state.getActualState(source, pos))];
|
||||
}
|
||||
|
||||
private static int getAABBIndex(IBlockState state) {
|
||||
private static int getAABBIndex(BlockState state) {
|
||||
int i = 0;
|
||||
boolean n = state.getValue(NORTH) != AttachPos.NONE;
|
||||
boolean e = state.getValue(EAST) != AttachPos.NONE;
|
||||
|
@ -86,38 +86,38 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
boolean w = state.getValue(WEST) != AttachPos.NONE;
|
||||
|
||||
if (n || s && !n && !e && !w) {
|
||||
i |= 1 << EnumFacing.NORTH.getHorizontalIndex();
|
||||
i |= 1 << Direction.NORTH.getHorizontalIndex();
|
||||
}
|
||||
if (e || w && !n && !e && !s) {
|
||||
i |= 1 << EnumFacing.EAST.getHorizontalIndex();
|
||||
i |= 1 << Direction.EAST.getHorizontalIndex();
|
||||
}
|
||||
if (s || n && !e && !s && !w) {
|
||||
i |= 1 << EnumFacing.SOUTH.getHorizontalIndex();
|
||||
i |= 1 << Direction.SOUTH.getHorizontalIndex();
|
||||
}
|
||||
if (w || e && !n && !s && !w) {
|
||||
i |= 1 << EnumFacing.WEST.getHorizontalIndex();
|
||||
i |= 1 << Direction.WEST.getHorizontalIndex();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
state = state.withProperty(WEST, this.getAttachPosition(worldIn, pos, EnumFacing.WEST));
|
||||
state = state.withProperty(EAST, this.getAttachPosition(worldIn, pos, EnumFacing.EAST));
|
||||
state = state.withProperty(NORTH, this.getAttachPosition(worldIn, pos, EnumFacing.NORTH));
|
||||
state = state.withProperty(SOUTH, this.getAttachPosition(worldIn, pos, EnumFacing.SOUTH));
|
||||
public BlockState getActualState(BlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
state = state.withProperty(WEST, this.getAttachPosition(worldIn, pos, Direction.WEST));
|
||||
state = state.withProperty(EAST, this.getAttachPosition(worldIn, pos, Direction.EAST));
|
||||
state = state.withProperty(NORTH, this.getAttachPosition(worldIn, pos, Direction.NORTH));
|
||||
state = state.withProperty(SOUTH, this.getAttachPosition(worldIn, pos, Direction.SOUTH));
|
||||
return state;
|
||||
}
|
||||
|
||||
private AttachPos getAttachPosition(IBlockAccess worldIn, BlockPos pos, EnumFacing direction) {
|
||||
private AttachPos getAttachPosition(IBlockAccess worldIn, BlockPos pos, Direction direction) {
|
||||
BlockPos dirPos = pos.offset(direction);
|
||||
IBlockState state = worldIn.getBlockState(pos.offset(direction));
|
||||
BlockState state = worldIn.getBlockState(pos.offset(direction));
|
||||
|
||||
if (!this.canConnectTo(worldIn.getBlockState(dirPos), direction, worldIn, dirPos)
|
||||
&& (state.isNormalCube() || !this.canConnectUpwardsTo(worldIn, dirPos.down()))) {
|
||||
IBlockState iblockstate1 = worldIn.getBlockState(pos.up());
|
||||
BlockState iblockstate1 = worldIn.getBlockState(pos.up());
|
||||
if (!iblockstate1.isNormalCube()) {
|
||||
boolean flag = worldIn.getBlockState(dirPos).isSideSolid(worldIn, dirPos, EnumFacing.UP)
|
||||
boolean flag = worldIn.getBlockState(dirPos).isSideSolid(worldIn, dirPos, Direction.UP)
|
||||
|| worldIn.getBlockState(dirPos).getBlock() == Blocks.GLOWSTONE;
|
||||
if (flag && this.canConnectUpwardsTo(worldIn, dirPos.up())) {
|
||||
if (state.isBlockNormalCube()) {
|
||||
|
@ -133,30 +133,30 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return NULL_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
|
||||
IBlockState downState = worldIn.getBlockState(pos.down());
|
||||
BlockState downState = worldIn.getBlockState(pos.down());
|
||||
return downState.isTopSolid()
|
||||
|| downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID
|
||||
|| downState.getBlockFaceShape(worldIn, pos.down(), Direction.UP) == BlockFaceShape.SOLID
|
||||
|| worldIn.getBlockState(pos.down()).getBlock() == Blocks.GLOWSTONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
if (!worldIn.isRemote) {
|
||||
if (!this.canPlaceBlockAt(worldIn, pos)) {
|
||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||
|
@ -169,19 +169,19 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
return this.canConnectTo(worldIn.getBlockState(pos), null, worldIn, pos);
|
||||
}
|
||||
|
||||
private boolean canConnectTo(IBlockState blockState, @Nullable EnumFacing side, IBlockAccess world, BlockPos pos) {
|
||||
private boolean canConnectTo(BlockState blockState, @Nullable Direction side, IBlockAccess world, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
return block == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,32 +4,32 @@ import de.ellpeck.naturesaura.Helper;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.reg.*;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeColorHelper;
|
||||
import net.minecraft.world.biome.BiomeColors;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockGoldenLeaves extends BlockLeaves implements
|
||||
public class BlockGoldenLeaves extends LeavesBlock implements
|
||||
IModItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem {
|
||||
|
||||
private static final int HIGHEST_STAGE = 3;
|
||||
|
@ -41,8 +41,8 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return MapColor.GOLD;
|
||||
public MaterialColor getMapColor(BlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
return MaterialColor.GOLD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,8 +66,8 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
if (stateIn.getValue(STAGE) == HIGHEST_STAGE && rand.nextFloat() >= 0.75F)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
pos.getX() + rand.nextFloat(),
|
||||
|
@ -90,7 +90,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
boolean check = (meta & 4) != 0; // 4th bit
|
||||
boolean decay = (meta & 8) != 0; // 3rd bit
|
||||
int stage = meta & HIGHEST_STAGE; // 1st and 2nd bit
|
||||
|
@ -99,7 +99,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
boolean check = state.getValue(CHECK_DECAY);
|
||||
boolean decay = state.getValue(DECAYABLE);
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) {
|
||||
public void beginLeavesDecay(BlockState state, World world, BlockPos pos) {
|
||||
if (!state.getValue(CHECK_DECAY) && state.getValue(DECAYABLE)) {
|
||||
world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
|
||||
}
|
||||
|
@ -119,12 +119,12 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IBlockColor getBlockColor() {
|
||||
return (state, worldIn, pos, tintIndex) -> {
|
||||
int color = 0xF2FF00;
|
||||
if (state != null && worldIn != null && pos != null) {
|
||||
int foliage = BiomeColorHelper.getFoliageColorAtPos(worldIn, pos);
|
||||
int foliage = BiomeColors.getFoliageColorAtPos(worldIn, pos);
|
||||
return Helper.blendColors(color, foliage, state.getValue(STAGE) / (float) HIGHEST_STAGE);
|
||||
} else {
|
||||
return color;
|
||||
|
@ -133,13 +133,13 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public IItemColor getItemColor() {
|
||||
return (stack, tintIndex) -> 0xF2FF00;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) {
|
||||
Random rand = world instanceof World ? ((World) world).rand : RANDOM;
|
||||
if (state.getValue(STAGE) < HIGHEST_STAGE) {
|
||||
if (rand.nextFloat() >= 0.75F) {
|
||||
|
@ -151,7 +151,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) {
|
||||
super.updateTick(worldIn, pos, state, rand);
|
||||
if (!worldIn.isRemote) {
|
||||
int stage = state.getValue(STAGE);
|
||||
|
@ -160,7 +160,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
if (stage > 1) {
|
||||
BlockPos offset = pos.offset(EnumFacing.random(rand));
|
||||
BlockPos offset = pos.offset(Direction.random(rand));
|
||||
if (worldIn.isBlockLoaded(offset))
|
||||
convert(worldIn, offset);
|
||||
}
|
||||
|
@ -168,12 +168,12 @@ public class BlockGoldenLeaves extends BlockLeaves implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean convert(World world, BlockPos pos) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (state.getBlock().isLeaves(state, world, pos) &&
|
||||
!(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) {
|
||||
if (!world.isRemote) {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package de.ellpeck.naturesaura.blocks;
|
||||
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute;
|
||||
import net.minecraft.block.BlockHopper;
|
||||
import net.minecraft.block.HopperBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
|
@ -19,8 +19,8 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||
|
||||
public class BlockGratedChute extends BlockContainerImpl {
|
||||
|
||||
public static final PropertyDirection FACING = BlockHopper.FACING;
|
||||
public static final PropertyDirection FACING = HopperBlock.FACING;
|
||||
private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D);
|
||||
private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
|
||||
private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
|
||||
|
@ -43,7 +43,7 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (!playerIn.isSneaking())
|
||||
return false;
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
|
@ -58,12 +58,12 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean isActualState) {
|
||||
public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean isActualState) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB);
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB);
|
||||
|
@ -72,7 +72,7 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) {
|
||||
EnumFacing newFacing = facing.getOpposite();
|
||||
if (newFacing == EnumFacing.UP)
|
||||
newFacing = EnumFacing.DOWN;
|
||||
|
@ -80,38 +80,38 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopSolid(IBlockState state) {
|
||||
public boolean isTopSolid(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
public EnumBlockRenderType getRenderType(BlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityGratedChute) {
|
||||
IItemHandler handler = ((TileEntityGratedChute) tile).getItemHandler(null);
|
||||
|
@ -124,28 +124,28 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return state.getValue(FACING).getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
public BlockState withRotation(BlockState state, Rotation rot) {
|
||||
return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
||||
public BlockState withMirror(BlockState state, Mirror mirrorIn) {
|
||||
return state.withRotation(mirrorIn.toRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, EnumFacing face) {
|
||||
return face == EnumFacing.UP ? BlockFaceShape.BOWL : BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable {
|
||||
public BlockHopperUpgrade() {
|
||||
|
@ -18,13 +18,13 @@ public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualiza
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return new AxisAlignedBB(pos).grow(7);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0x434f3f;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable {
|
||||
public BlockMossGenerator() {
|
||||
|
@ -18,13 +18,13 @@ public class BlockMossGenerator extends BlockContainerImpl implements IVisualiza
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return new AxisAlignedBB(pos).grow(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0x15702d;
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
|
|||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
|
@ -30,43 +30,43 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
||||
return Helper.putStackOnTile(playerIn, hand, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BOUND_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return side == EnumFacing.DOWN;
|
||||
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return side == Direction.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Tuple<Class, TileEntitySpecialRenderer> getTESR() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityNatureAltar.class, new RenderNatureAltar());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.api.render.IVisualizable;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOakGenerator;
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.SaplingBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -13,9 +13,9 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
World world = event.getWorld();
|
||||
BlockPos pos = event.getPos();
|
||||
if (!world.isRemote && IAuraType.forWorld(world).isSimilar(NaturesAuraAPI.TYPE_OVERWORLD)
|
||||
&& world.getBlockState(pos).getBlock() instanceof BlockSapling) {
|
||||
&& world.getBlockState(pos).getBlock() instanceof SaplingBlock) {
|
||||
Helper.getTileEntitiesInArea(world, pos, 10, tile -> {
|
||||
if (!(tile instanceof TileEntityOakGenerator))
|
||||
return false;
|
||||
|
@ -57,13 +57,13 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return new AxisAlignedBB(pos).grow(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0x2e7a11;
|
||||
}
|
||||
|
|
|
@ -7,18 +7,18 @@ import de.ellpeck.naturesaura.reg.ITESRProvider;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
|
@ -31,43 +31,43 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
||||
return Helper.putStackOnTile(playerIn, hand, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BOUND_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Tuple<Class, TileEntitySpecialRenderer> getTESR() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityOfferingTable.class, new RenderOfferingTable());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,17 +7,17 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
|||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable {
|
||||
public BlockPickupStopper() {
|
||||
|
@ -30,9 +30,9 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
|
||||
@SubscribeEvent
|
||||
public void onPickup(EntityItemPickupEvent event) {
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
if (player != null && !player.isSneaking()) {
|
||||
EntityItem item = event.getItem();
|
||||
ItemEntity item = event.getItem();
|
||||
BlockPos pos = item.getPosition();
|
||||
Helper.getTileEntitiesInArea(item.world, pos, 8, tile -> {
|
||||
if (!(tile instanceof TileEntityPickupStopper))
|
||||
|
@ -56,7 +56,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityPickupStopper) {
|
||||
|
@ -68,7 +68,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0xf4aa42;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockPlacer extends BlockContainerImpl implements IVisualizable {
|
||||
|
||||
|
@ -19,13 +19,13 @@ public class BlockPlacer extends BlockContainerImpl implements IVisualizable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return new AxisAlignedBB(pos).grow(5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0x078a93;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityPowderPlacer;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -20,32 +20,32 @@ public class BlockPowderPlacer extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BOUND_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
return side == EnumFacing.DOWN;
|
||||
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return side == Direction.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,11 +9,11 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
|
|||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
|
@ -22,9 +22,9 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider {
|
||||
public BlockProjectileGenerator() {
|
||||
|
@ -70,18 +70,18 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Tuple<Class, TileEntitySpecialRenderer> getTESR() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityProjectileGenerator.class, new RenderProjectileGenerator());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -40,7 +40,7 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public CreativeTabs getTabToAdd() {
|
||||
public ItemGroup getTabToAdd() {
|
||||
return this.isDouble() ? null : super.getTabToAdd();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
if (this.isDouble())
|
||||
return FULL_BLOCK_AABB;
|
||||
else
|
||||
|
@ -58,42 +58,42 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopSolid(IBlockState state) {
|
||||
public boolean isTopSolid(BlockState state) {
|
||||
return this.isDouble() || state.getValue(HALF) == EnumBlockHalf.TOP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
if (this.isDouble())
|
||||
return BlockFaceShape.SOLID;
|
||||
else if (face == EnumFacing.UP && state.getValue(HALF) == EnumBlockHalf.TOP)
|
||||
else if (face == Direction.UP && state.getValue(HALF) == EnumBlockHalf.TOP)
|
||||
return BlockFaceShape.SOLID;
|
||||
else
|
||||
return face == EnumFacing.DOWN && state.getValue(HALF) == EnumBlockHalf.BOTTOM ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
|
||||
return face == Direction.DOWN && state.getValue(HALF) == EnumBlockHalf.BOTTOM ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return this.isDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return this.isDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullBlock(IBlockState state) {
|
||||
public boolean isFullBlock(BlockState state) {
|
||||
return this.isDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return this.isDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
public boolean doesSideBlockRendering(BlockState state, IBlockAccess world, BlockPos pos, Direction face) {
|
||||
if (ForgeModContainer.disableStairSlabCulling)
|
||||
return super.doesSideBlockRendering(state, world, pos, face);
|
||||
|
||||
|
@ -101,16 +101,16 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock
|
|||
return true;
|
||||
|
||||
EnumBlockHalf side = state.getValue(HALF);
|
||||
return (side == EnumBlockHalf.TOP && face == EnumFacing.UP) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.DOWN);
|
||||
return (side == EnumBlockHalf.TOP && face == Direction.UP) || (side == EnumBlockHalf.BOTTOM && face == Direction.DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
|
||||
public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) {
|
||||
if (this.isDouble())
|
||||
return this.getDefaultState();
|
||||
else {
|
||||
IBlockState state = this.getStateFromMeta(meta);
|
||||
return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double) hitY <= 0.5D) ?
|
||||
BlockState state = this.getStateFromMeta(meta);
|
||||
return facing != Direction.DOWN && (facing == Direction.UP || (double) hitY <= 0.5D) ?
|
||||
state.withProperty(HALF, EnumBlockHalf.BOTTOM) : state.withProperty(HALF, EnumBlockHalf.TOP);
|
||||
}
|
||||
}
|
||||
|
@ -121,12 +121,12 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
|
||||
public Item getItemDropped(BlockState state, Random rand, int fortune) {
|
||||
return Item.getItemFromBlock(this.singleSlab.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBlock getItemBlock() {
|
||||
public BlockItem getItemBlock() {
|
||||
return new ItemSlabNA(this, this.singleSlab, this.doubleSlab);
|
||||
}
|
||||
|
||||
|
@ -136,12 +136,12 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
public int getMetaFromState(BlockState state) {
|
||||
return this.isDouble() ? 0 : (state.getValue(HALF) == EnumBlockHalf.TOP ? 1 : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
public BlockState getStateFromMeta(int meta) {
|
||||
return this.isDouble() ? this.getDefaultState() : this.getDefaultState().withProperty(HALF, meta == 1 ? EnumBlockHalf.TOP : EnumBlockHalf.BOTTOM);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ import de.ellpeck.naturesaura.packet.PacketParticles;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.MobEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -21,10 +21,10 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable {
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
|
|||
if (!new AxisAlignedBB(lampPos).grow(range).contains(new Vec3d(pos)))
|
||||
return false;
|
||||
|
||||
EntityLiving entity = (EntityLiving) event.getEntityLiving();
|
||||
MobEntity entity = (MobEntity) event.getEntityLiving();
|
||||
if (entity.getCanSpawnHere() && entity.isNotColliding()) {
|
||||
BlockPos spot = IAuraChunk.getHighestSpot(world, lampPos, 32, lampPos);
|
||||
IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 200);
|
||||
|
@ -71,43 +71,43 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntitySpawnLamp) {
|
||||
|
@ -119,7 +119,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return 0x825ee5;
|
||||
}
|
||||
|
|
|
@ -4,19 +4,19 @@ import de.ellpeck.naturesaura.reg.ICreativeItem;
|
|||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.IModelProvider;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.StairsBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
public class BlockStairsNA extends BlockStairs implements IModItem, ICreativeItem, IModelProvider {
|
||||
public class BlockStairsNA extends StairsBlock implements IModItem, ICreativeItem, IModelProvider {
|
||||
|
||||
private final String baseName;
|
||||
|
||||
protected BlockStairsNA(String baseName, IBlockState modelState) {
|
||||
protected BlockStairsNA(String baseName, BlockState modelState) {
|
||||
super(modelState);
|
||||
this.baseName = baseName;
|
||||
ModRegistry.add(this);
|
||||
|
@ -45,22 +45,22 @@ public class BlockStairsNA extends BlockStairs implements IModItem, ICreativeIte
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullBlock(IBlockState state) {
|
||||
public boolean isFullBlock(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,14 @@ import de.ellpeck.naturesaura.reg.ITESRProvider;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockFaceShape;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -25,9 +25,9 @@ import net.minecraft.world.IBlockAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -53,7 +53,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider
|
|||
BlockPos pos = event.getPos();
|
||||
if (!world.isRemote) {
|
||||
if (Multiblocks.TREE_RITUAL.isComplete(world, pos)) {
|
||||
IBlockState sapling = world.getBlockState(pos);
|
||||
BlockState sapling = world.getBlockState(pos);
|
||||
ItemStack saplingStack = sapling.getBlock().getItem(world, pos, sapling);
|
||||
if (!saplingStack.isEmpty()) {
|
||||
for (TreeRitualRecipe recipe : NaturesAuraAPI.TREE_RITUAL_RECIPES.values()) {
|
||||
|
@ -96,43 +96,43 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) {
|
||||
return Helper.putStackOnTile(playerIn, hand, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BOUND_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
public boolean isFullCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
public boolean isOpaqueCube(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
|
||||
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Tuple<Class, TileEntitySpecialRenderer> getTESR() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityWoodStand.class, new RenderWoodStand());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.ModConfig;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
public final class ModBlocks {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
|
|||
import de.ellpeck.naturesaura.api.multiblock.Matcher;
|
||||
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -80,8 +80,8 @@ public class Multiblock implements IMultiblock {
|
|||
continue;
|
||||
|
||||
Object value = rawMatchers[i + 1];
|
||||
if (value instanceof IBlockState) {
|
||||
IBlockState state = (IBlockState) value;
|
||||
if (value instanceof BlockState) {
|
||||
BlockState state = (BlockState) value;
|
||||
matchers.put(c, new Matcher(state,
|
||||
(world, start, offset, pos, other, otherC) -> other == state));
|
||||
} else if (value instanceof Block) {
|
||||
|
|
|
@ -6,11 +6,11 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.multiblock.IMultiblock;
|
||||
import de.ellpeck.naturesaura.api.multiblock.Matcher;
|
||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.BlockSapling;
|
||||
import net.minecraft.block.LogBlock;
|
||||
import net.minecraft.block.SaplingBlock;
|
||||
import net.minecraft.block.BlockStoneBrick;
|
||||
import net.minecraft.block.BlockStoneBrick.EnumType;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
@ -38,7 +38,7 @@ public final class Multiblocks {
|
|||
'G', ModBlocks.GOLD_POWDER,
|
||||
'0', new Matcher(Blocks.SAPLING.getDefaultState(),
|
||||
(world, start, offset, pos, state, c) -> {
|
||||
if (state.getBlock() instanceof BlockSapling || state.getBlock() instanceof BlockLog)
|
||||
if (state.getBlock() instanceof SaplingBlock || state.getBlock() instanceof LogBlock)
|
||||
return true;
|
||||
// try-catch to prevent blocks that need to have been placed crashing here
|
||||
try {
|
||||
|
|
|
@ -3,8 +3,8 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||
import de.ellpeck.naturesaura.api.aura.container.NaturalAuraContainer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
public class TileEntityAncientLeaves extends TileEntityImpl {
|
||||
|
||||
|
@ -25,19 +25,19 @@ public class TileEntityAncientLeaves extends TileEntityImpl {
|
|||
};
|
||||
|
||||
@Override
|
||||
public IAuraContainer getAuraContainer(EnumFacing facing) {
|
||||
public IAuraContainer getAuraContainer(Direction facing) {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK)
|
||||
this.container.writeNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK)
|
||||
this.container.readNBT(compound);
|
||||
|
|
|
@ -9,10 +9,10 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
|||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -60,14 +60,14 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
this.sendToClients();
|
||||
}
|
||||
} else {
|
||||
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class,
|
||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class,
|
||||
new AxisAlignedBB(this.pos).grow(2));
|
||||
|
||||
for (AnimalSpawnerRecipe recipe : NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.values()) {
|
||||
if (recipe.ingredients.length != items.size())
|
||||
continue;
|
||||
List<Ingredient> required = new ArrayList<>(Arrays.asList(recipe.ingredients));
|
||||
for (EntityItem item : items) {
|
||||
for (ItemEntity item : items) {
|
||||
if (item.isDead || item.cannotPickup())
|
||||
break;
|
||||
ItemStack stack = item.getItem();
|
||||
|
@ -83,7 +83,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
if (!required.isEmpty())
|
||||
continue;
|
||||
|
||||
for (EntityItem item : items) {
|
||||
for (ItemEntity item : items) {
|
||||
item.setDead();
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19));
|
||||
|
@ -129,7 +129,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
if (this.currentRecipe != null) {
|
||||
|
@ -142,7 +142,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
if (compound.hasKey("recipe")) {
|
||||
|
|
|
@ -4,16 +4,16 @@ import de.ellpeck.naturesaura.blocks.BlockAutoCrafter;
|
|||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.CraftingInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EntityPredicates;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -22,9 +22,9 @@ import net.minecraft.util.math.BlockPos;
|
|||
import java.util.List;
|
||||
|
||||
public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable {
|
||||
public final InventoryCrafting crafting = new InventoryCrafting(new Container() {
|
||||
public final CraftingInventory crafting = new CraftingInventory(new Container() {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer playerIn) {
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return false;
|
||||
}
|
||||
}, 3, 3);
|
||||
|
@ -39,8 +39,8 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable {
|
|||
return;
|
||||
this.crafting.clear();
|
||||
|
||||
IBlockState state = this.world.getBlockState(this.pos);
|
||||
EnumFacing facing = state.getValue(BlockAutoCrafter.FACING);
|
||||
BlockState state = this.world.getBlockState(this.pos);
|
||||
Direction facing = state.getValue(BlockAutoCrafter.FACING);
|
||||
BlockPos middlePos = this.pos.up();
|
||||
BlockPos topPos = middlePos.offset(facing, 2);
|
||||
BlockPos bottomPos = middlePos.offset(facing.getOpposite(), 2);
|
||||
|
@ -56,15 +56,15 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable {
|
|||
bottomPos.offset(facing.rotateY(), 2)
|
||||
};
|
||||
|
||||
EntityItem[] items = new EntityItem[9];
|
||||
ItemEntity[] items = new ItemEntity[9];
|
||||
for (int i = 0; i < poses.length; i++) {
|
||||
List<EntityItem> entities = this.world.getEntitiesWithinAABB(
|
||||
EntityItem.class, new AxisAlignedBB(poses[i]).grow(0.25), EntitySelectors.IS_ALIVE);
|
||||
List<ItemEntity> entities = this.world.getEntitiesWithinAABB(
|
||||
ItemEntity.class, new AxisAlignedBB(poses[i]).grow(0.25), EntityPredicates.IS_ALIVE);
|
||||
if (entities.size() > 1)
|
||||
return;
|
||||
if (entities.isEmpty())
|
||||
continue;
|
||||
EntityItem entity = entities.get(0);
|
||||
ItemEntity entity = entities.get(0);
|
||||
if (entity.cannotPickup())
|
||||
return;
|
||||
ItemStack stack = entity.getItem();
|
||||
|
@ -81,14 +81,14 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable {
|
|||
ItemStack result = recipe.getCraftingResult(this.crafting);
|
||||
if (result.isEmpty())
|
||||
return;
|
||||
EntityItem resultItem = new EntityItem(this.world,
|
||||
ItemEntity resultItem = new ItemEntity(this.world,
|
||||
this.pos.getX() + 0.5F, this.pos.getY() - 0.35F, this.pos.getZ() + 0.5F, result.copy());
|
||||
resultItem.motionX = resultItem.motionY = resultItem.motionZ = 0;
|
||||
this.world.spawnEntity(resultItem);
|
||||
|
||||
NonNullList<ItemStack> remainingItems = recipe.getRemainingItems(this.crafting);
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
EntityItem item = items[i];
|
||||
ItemEntity item = items[i];
|
||||
if (item == null)
|
||||
continue;
|
||||
ItemStack stack = item.getItem();
|
||||
|
@ -101,7 +101,7 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable {
|
|||
|
||||
ItemStack remain = remainingItems.get(i);
|
||||
if (!remain.isEmpty()) {
|
||||
EntityItem remItem = new EntityItem(this.world, item.posX, item.posY, item.posZ, remain.copy());
|
||||
ItemEntity remItem = new ItemEntity(this.world, item.posX, item.posY, item.posZ, remain.copy());
|
||||
remItem.motionX = remItem.motionY = remItem.motionZ = 0;
|
||||
this.world.spawnEntity(remItem);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
|
|
|
@ -6,13 +6,13 @@ import de.ellpeck.naturesaura.api.aura.container.BasicAuraContainer;
|
|||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.EntityPredicates;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -54,9 +54,9 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickable {
|
|||
return;
|
||||
|
||||
if (!this.isDrainMode) {
|
||||
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class,
|
||||
new AxisAlignedBB(this.pos).grow(1), EntitySelectors.IS_ALIVE);
|
||||
for (EntityItem item : items) {
|
||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class,
|
||||
new AxisAlignedBB(this.pos).grow(1), EntityPredicates.IS_ALIVE);
|
||||
for (ItemEntity item : items) {
|
||||
if (item.cannotPickup())
|
||||
continue;
|
||||
ItemStack stack = item.getItem();
|
||||
|
@ -101,12 +101,12 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAuraContainer getAuraContainer(EnumFacing facing) {
|
||||
public IAuraContainer getAuraContainer(Direction facing) {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
this.container.writeNBT(compound);
|
||||
|
@ -115,7 +115,7 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
this.container.readNBT(compound);
|
||||
|
|
|
@ -4,10 +4,10 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.misc.IWorldData;
|
||||
import de.ellpeck.naturesaura.blocks.BlockEnderCrate;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class TileEntityEnderCrate extends TileEntityImpl {
|
|||
public String name;
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
if (this.canOpen())
|
||||
return this.wrappedEnderStorage;
|
||||
return null;
|
||||
|
@ -77,11 +77,11 @@ public class TileEntityEnderCrate extends TileEntityImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDrop(IBlockState state, int fortune) {
|
||||
public ItemStack getDrop(BlockState state, int fortune) {
|
||||
ItemStack drop = super.getDrop(state, fortune);
|
||||
if (this.name != null) {
|
||||
if (!drop.hasTagCompound())
|
||||
drop.setTagCompound(new NBTTagCompound());
|
||||
drop.setTagCompound(new CompoundNBT());
|
||||
drop.getTagCompound().setString(NaturesAura.MOD_ID + ":ender_name", this.name);
|
||||
}
|
||||
return drop;
|
||||
|
@ -98,7 +98,7 @@ public class TileEntityEnderCrate extends TileEntityImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
if (this.name != null)
|
||||
|
@ -107,7 +107,7 @@ public class TileEntityEnderCrate extends TileEntityImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
if (compound.hasKey("name"))
|
||||
|
|
|
@ -8,18 +8,18 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
|||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.item.ItemShears;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
import net.minecraft.item.ShearsItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
|
@ -111,13 +111,13 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable
|
|||
if (pos.equals(this.pos) || pos.equals(connectedPos))
|
||||
continue;
|
||||
|
||||
IBlockState state = this.world.getBlockState(pos);
|
||||
BlockState state = this.world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (!block.isAir(state, this.world, pos)
|
||||
&& !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock)
|
||||
&& state.getBlockHardness(this.world, pos) >= 0F) {
|
||||
|
||||
FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) this.world);
|
||||
FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) this.world);
|
||||
if (!MinecraftForge.EVENT_BUS.post(new BlockEvent.BreakEvent(this.world, pos, state, fake))) {
|
||||
boolean shearBlock = shears && block instanceof IShearable;
|
||||
List<ItemStack> drops;
|
||||
|
@ -143,10 +143,10 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
public boolean shears() {
|
||||
List<EntityItemFrame> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
for (EntityItemFrame frame : frames) {
|
||||
List<ItemFrameEntity> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
for (ItemFrameEntity frame : frames) {
|
||||
ItemStack stack = frame.getDisplayedItem();
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ItemShears)
|
||||
if (!stack.isEmpty() && stack.getItem() instanceof ShearsItem)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -179,7 +179,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
if (this.connectionOffset != null)
|
||||
|
@ -193,7 +193,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
if (compound.hasKey("connection"))
|
||||
|
|
|
@ -4,14 +4,14 @@ import com.google.common.primitives.Ints;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.item.EntityFireworkRocket;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.item.FireworkRocketEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.EntityPredicates;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -24,7 +24,7 @@ import java.util.Set;
|
|||
|
||||
public class TileEntityFireworkGenerator extends TileEntityImpl implements ITickable {
|
||||
|
||||
private EntityFireworkRocket trackedEntity;
|
||||
private FireworkRocketEntity trackedEntity;
|
||||
private ItemStack trackedItem;
|
||||
private int toRelease;
|
||||
private int releaseTimer;
|
||||
|
@ -33,16 +33,16 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
|||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
if (this.world.getTotalWorldTime() % 10 == 0) {
|
||||
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class,
|
||||
new AxisAlignedBB(this.pos).grow(4), EntitySelectors.IS_ALIVE);
|
||||
for (EntityItem item : items) {
|
||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class,
|
||||
new AxisAlignedBB(this.pos).grow(4), EntityPredicates.IS_ALIVE);
|
||||
for (ItemEntity item : items) {
|
||||
if (item.cannotPickup())
|
||||
continue;
|
||||
ItemStack stack = item.getItem();
|
||||
if (stack.isEmpty() || stack.getItem() != Items.FIREWORKS)
|
||||
continue;
|
||||
if (this.trackedEntity == null && this.releaseTimer <= 0) {
|
||||
EntityFireworkRocket entity = new EntityFireworkRocket(this.world, item.posX, item.posY, item.posZ, stack);
|
||||
FireworkRocketEntity entity = new FireworkRocketEntity(this.world, item.posX, item.posY, item.posZ, stack);
|
||||
this.trackedEntity = entity;
|
||||
this.trackedItem = stack.copy();
|
||||
this.world.spawnEntity(entity);
|
||||
|
@ -60,16 +60,16 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
|||
float generateFactor = 0;
|
||||
Set<Integer> usedColors = new HashSet<>();
|
||||
|
||||
NBTTagCompound compound = this.trackedItem.getTagCompound();
|
||||
NBTTagCompound fireworks = compound.getCompoundTag("Fireworks");
|
||||
CompoundNBT compound = this.trackedItem.getTagCompound();
|
||||
CompoundNBT fireworks = compound.getCompoundTag("Fireworks");
|
||||
|
||||
int flightTime = fireworks.getInteger("Flight");
|
||||
NBTTagList explosions = fireworks.getTagList("Explosions", 10);
|
||||
ListNBT explosions = fireworks.getTagList("Explosions", 10);
|
||||
if (!explosions.isEmpty()) {
|
||||
generateFactor += flightTime;
|
||||
|
||||
for (NBTBase base : explosions) {
|
||||
NBTTagCompound explosion = (NBTTagCompound) base;
|
||||
CompoundNBT explosion = (CompoundNBT) base;
|
||||
generateFactor += 1.5F;
|
||||
|
||||
boolean flicker = explosion.getBoolean("Flicker");
|
||||
|
|
|
@ -8,10 +8,10 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
|||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
|
||||
public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickable {
|
||||
|
||||
private final Map<IBlockState, MutableInt> consumedRecently = new HashMap<>();
|
||||
private final Map<BlockState, MutableInt> consumedRecently = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
@ -36,7 +36,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -range; z <= range; z++) {
|
||||
BlockPos offset = this.pos.add(x, y, z);
|
||||
IBlockState state = this.world.getBlockState(offset);
|
||||
BlockState state = this.world.getBlockState(offset);
|
||||
if (NaturesAuraAPI.FLOWERS.contains(state)) {
|
||||
possible.add(offset);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
return;
|
||||
|
||||
BlockPos pos = possible.get(this.world.rand.nextInt(possible.size()));
|
||||
IBlockState state = this.world.getBlockState(pos);
|
||||
BlockState state = this.world.getBlockState(pos);
|
||||
MutableInt curr = this.consumedRecently.computeIfAbsent(state, s -> new MutableInt());
|
||||
|
||||
int addAmount = 25000;
|
||||
|
@ -64,7 +64,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
toAdd = 0;
|
||||
}
|
||||
|
||||
for (Map.Entry<IBlockState, MutableInt> entry : this.consumedRecently.entrySet()) {
|
||||
for (Map.Entry<BlockState, MutableInt> entry : this.consumedRecently.entrySet()) {
|
||||
if (entry.getKey() != state) {
|
||||
MutableInt val = entry.getValue();
|
||||
if (val.getValue() > 0)
|
||||
|
@ -99,16 +99,16 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
|
||||
if (type != SaveType.SYNC && !this.consumedRecently.isEmpty()) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (Map.Entry<IBlockState, MutableInt> entry : this.consumedRecently.entrySet()) {
|
||||
IBlockState state = entry.getKey();
|
||||
ListNBT list = new ListNBT();
|
||||
for (Map.Entry<BlockState, MutableInt> entry : this.consumedRecently.entrySet()) {
|
||||
BlockState state = entry.getKey();
|
||||
Block block = state.getBlock();
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
tag.setString("block", block.getRegistryName().toString());
|
||||
tag.setInteger("meta", block.getMetaFromState(state));
|
||||
tag.setInteger("amount", entry.getValue().intValue());
|
||||
|
@ -119,19 +119,19 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
|
||||
if (type != SaveType.SYNC) {
|
||||
this.consumedRecently.clear();
|
||||
|
||||
NBTTagList list = compound.getTagList("consumed_recently", 10);
|
||||
ListNBT list = compound.getTagList("consumed_recently", 10);
|
||||
for (NBTBase base : list) {
|
||||
NBTTagCompound tag = (NBTTagCompound) base;
|
||||
CompoundNBT tag = (CompoundNBT) base;
|
||||
|
||||
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(tag.getString("block")));
|
||||
if (block != null) {
|
||||
IBlockState state = block.getStateFromMeta(tag.getInteger("meta"));
|
||||
BlockState state = block.getStateFromMeta(tag.getInteger("meta"));
|
||||
this.consumedRecently.put(state, new MutableInt(tag.getInteger("amount")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
|||
import de.ellpeck.naturesaura.blocks.BlockFurnaceHeater;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import net.minecraft.block.BlockFurnace;
|
||||
import net.minecraft.block.FurnaceBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -26,15 +26,15 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
|||
if (!this.world.isRemote && this.world.getTotalWorldTime() % 5 == 0) {
|
||||
boolean did = false;
|
||||
|
||||
EnumFacing facing = this.world.getBlockState(this.pos).getValue(BlockFurnaceHeater.FACING);
|
||||
Direction facing = this.world.getBlockState(this.pos).getValue(BlockFurnaceHeater.FACING);
|
||||
BlockPos tilePos = this.pos.offset(facing.getOpposite());
|
||||
TileEntity tile = this.world.getTileEntity(tilePos);
|
||||
if (tile instanceof TileEntityFurnace) {
|
||||
TileEntityFurnace furnace = (TileEntityFurnace) tile;
|
||||
if (tile instanceof FurnaceTileEntity) {
|
||||
FurnaceTileEntity furnace = (FurnaceTileEntity) tile;
|
||||
if (isReady(furnace)) {
|
||||
int time = furnace.getField(0);
|
||||
if (time <= 0)
|
||||
BlockFurnace.setState(true, this.world, furnace.getPos());
|
||||
FurnaceBlock.setState(true, this.world, furnace.getPos());
|
||||
furnace.setField(0, 200);
|
||||
//if set higher than 199, it'll never finish because the furnace does ++ and then ==
|
||||
furnace.setField(2, Math.min(199, furnace.getField(2) + 5));
|
||||
|
@ -65,7 +65,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isReady(TileEntityFurnace furnace) {
|
||||
private static boolean isReady(FurnaceTileEntity furnace) {
|
||||
if (!furnace.getStackInSlot(1).isEmpty())
|
||||
return false;
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
|
||||
if (type == SaveType.SYNC)
|
||||
|
@ -91,7 +91,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
|
||||
if (type == SaveType.SYNC)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class TileEntityGeneratorLimitRemover extends TileEntityImpl {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return new AxisAlignedBB(this.pos, this.pos.add(1, 2, 1));
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.blocks.BlockGratedChute;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
|
@ -44,8 +44,8 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable {
|
|||
ItemStack curr = this.items.getStackInSlot(0);
|
||||
push:
|
||||
if (!curr.isEmpty()) {
|
||||
IBlockState state = this.world.getBlockState(this.pos);
|
||||
EnumFacing facing = state.getValue(BlockGratedChute.FACING);
|
||||
BlockState state = this.world.getBlockState(this.pos);
|
||||
Direction facing = state.getValue(BlockGratedChute.FACING);
|
||||
TileEntity tile = this.world.getTileEntity(this.pos.offset(facing));
|
||||
if (tile == null || !tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,
|
||||
facing.getOpposite()))
|
||||
|
@ -67,10 +67,10 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
pull:
|
||||
if (curr.isEmpty() || curr.getCount() < curr.getMaxStackSize()) {
|
||||
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(
|
||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(
|
||||
this.pos.getX(), this.pos.getY() + 0.5, this.pos.getZ(),
|
||||
this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1));
|
||||
for (EntityItem item : items) {
|
||||
for (ItemEntity item : items) {
|
||||
if (item.isDead)
|
||||
continue;
|
||||
ItemStack stack = item.getItem();
|
||||
|
@ -87,9 +87,9 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
TileEntity tileUp = this.world.getTileEntity(this.pos.up());
|
||||
if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
|
||||
if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN))
|
||||
break pull;
|
||||
IItemHandler handlerUp = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||
IItemHandler handlerUp = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN);
|
||||
if (handlerUp == null)
|
||||
break pull;
|
||||
for (int i = 0; i < handlerUp.getSlots(); i++) {
|
||||
|
@ -109,10 +109,10 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
private boolean isItemInFrame(ItemStack stack) {
|
||||
List<EntityItemFrame> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
List<ItemFrameEntity> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
if (frames.isEmpty())
|
||||
return false;
|
||||
for (EntityItemFrame frame : frames) {
|
||||
for (ItemFrameEntity frame : frames) {
|
||||
ItemStack frameStack = frame.getDisplayedItem();
|
||||
if (Helper.areItemsEqual(stack, frameStack, true)) {
|
||||
return true;
|
||||
|
@ -122,7 +122,7 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
compound.setInteger("cooldown", this.cooldown);
|
||||
|
@ -132,7 +132,7 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
this.cooldown = compound.getInteger("cooldown");
|
||||
|
@ -142,7 +142,7 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockHopper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.block.HopperBlock;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityHopper;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.tileentity.HopperTileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -26,18 +26,18 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable
|
|||
TileEntity tile = this.world.getTileEntity(this.pos.down());
|
||||
if (!isValidHopper(tile))
|
||||
return;
|
||||
if (!tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP))
|
||||
if (!tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP))
|
||||
return;
|
||||
IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP);
|
||||
IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP);
|
||||
if (handler == null)
|
||||
return;
|
||||
|
||||
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class,
|
||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class,
|
||||
new AxisAlignedBB(this.pos).grow(7));
|
||||
if (items.isEmpty())
|
||||
return;
|
||||
|
||||
for (EntityItem item : items) {
|
||||
for (ItemEntity item : items) {
|
||||
if (item.isDead || item.cannotPickup())
|
||||
continue;
|
||||
ItemStack stack = item.getItem();
|
||||
|
@ -68,8 +68,8 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
private static boolean isValidHopper(TileEntity tile) {
|
||||
if (tile instanceof TileEntityHopper)
|
||||
return BlockHopper.isEnabled(tile.getBlockMetadata());
|
||||
if (tile instanceof HopperTileEntity)
|
||||
return HopperBlock.isEnabled(tile.getBlockMetadata());
|
||||
if (tile instanceof TileEntityGratedChute)
|
||||
return ((TileEntityGratedChute) tile).redstonePower <= 0;
|
||||
return false;
|
||||
|
|
|
@ -5,18 +5,18 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
||||
import net.minecraft.server.management.PlayerChunkMapEntry;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
@ -29,29 +29,29 @@ public class TileEntityImpl extends TileEntity {
|
|||
public int redstonePower;
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
|
||||
public boolean shouldRefresh(World world, BlockPos pos, BlockState oldState, BlockState newState) {
|
||||
return oldState.getBlock() != newState.getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
public CompoundNBT writeToNBT(CompoundNBT compound) {
|
||||
this.writeNBT(compound, SaveType.TILE);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
public void readFromNBT(CompoundNBT compound) {
|
||||
this.readNBT(compound, SaveType.TILE);
|
||||
}
|
||||
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
if (type != SaveType.BLOCK) {
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("redstone", this.redstonePower);
|
||||
}
|
||||
}
|
||||
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
if (type != SaveType.BLOCK) {
|
||||
super.readFromNBT(compound);
|
||||
this.redstonePower = compound.getInteger("redstone");
|
||||
|
@ -63,48 +63,48 @@ public class TileEntityImpl extends TileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final SPacketUpdateTileEntity getUpdatePacket() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
public final SUpdateTileEntityPacket getUpdatePacket() {
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
this.writeNBT(compound, SaveType.SYNC);
|
||||
return new SPacketUpdateTileEntity(this.pos, 0, compound);
|
||||
return new SUpdateTileEntityPacket(this.pos, 0, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final NBTTagCompound getUpdateTag() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
public final CompoundNBT getUpdateTag() {
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
this.writeNBT(compound, SaveType.SYNC);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUpdateTag(NBTTagCompound tag) {
|
||||
public void handleUpdateTag(CompoundNBT tag) {
|
||||
this.readNBT(tag, SaveType.SYNC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket packet) {
|
||||
super.onDataPacket(net, packet);
|
||||
this.readNBT(packet.getNbtCompound(), SaveType.SYNC);
|
||||
}
|
||||
|
||||
public void sendToClients() {
|
||||
WorldServer world = (WorldServer) this.getWorld();
|
||||
ServerWorld world = (ServerWorld) this.getWorld();
|
||||
PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(this.getPos().getX() >> 4, this.getPos().getZ() >> 4);
|
||||
if (entry != null) {
|
||||
entry.sendPacket(this.getUpdatePacket());
|
||||
}
|
||||
}
|
||||
|
||||
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public IAuraContainer getAuraContainer(EnumFacing facing) {
|
||||
public IAuraContainer getAuraContainer(Direction facing) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable Direction facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return this.getItemHandler(facing) != null;
|
||||
} else if (capability == NaturesAuraAPI.capAuraContainer) {
|
||||
|
@ -116,7 +116,7 @@ public class TileEntityImpl extends TileEntity {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable Direction facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
return (T) this.getItemHandler(facing);
|
||||
} else if (capability == NaturesAuraAPI.capAuraContainer) {
|
||||
|
@ -132,7 +132,7 @@ public class TileEntityImpl extends TileEntity {
|
|||
for (int i = 0; i < handler.getSlots(); i++) {
|
||||
ItemStack stack = handler.getStackInSlot(i);
|
||||
if (!stack.isEmpty()) {
|
||||
EntityItem item = new EntityItem(this.world,
|
||||
ItemEntity item = new ItemEntity(this.world,
|
||||
this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5,
|
||||
stack);
|
||||
this.world.spawnEntity(item);
|
||||
|
@ -141,18 +141,18 @@ public class TileEntityImpl extends TileEntity {
|
|||
}
|
||||
}
|
||||
|
||||
public ItemStack getDrop(IBlockState state, int fortune) {
|
||||
public ItemStack getDrop(BlockState state, int fortune) {
|
||||
Block block = state.getBlock();
|
||||
ItemStack stack = new ItemStack(
|
||||
block.getItemDropped(state, this.world.rand, fortune),
|
||||
block.quantityDropped(state, fortune, this.world.rand),
|
||||
block.damageDropped(state));
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
this.writeNBT(compound, SaveType.BLOCK);
|
||||
|
||||
if (!compound.isEmpty()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.setTagCompound(new CompoundNBT());
|
||||
stack.getTagCompound().setTag("data", compound);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class TileEntityImpl extends TileEntity {
|
|||
|
||||
public void loadDataOnPlace(ItemStack stack) {
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("data");
|
||||
CompoundNBT compound = stack.getTagCompound().getCompoundTag("data");
|
||||
if (compound != null)
|
||||
this.readNBT(compound, SaveType.BLOCK);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public class TileEntityImpl extends TileEntity {
|
|||
|
||||
public boolean canGenerateRightNow(int range, int toAdd) {
|
||||
if (this.wantsLimitRemover()) {
|
||||
IBlockState below = this.world.getBlockState(this.pos.down());
|
||||
BlockState below = this.world.getBlockState(this.pos.down());
|
||||
if (below.getBlock() == ModBlocks.GENERATOR_LIMIT_REMOVER)
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable
|
|||
for (int y = -range; y <= range; y++)
|
||||
for (int z = -range; z <= range; z++) {
|
||||
BlockPos offset = this.pos.add(x, y, z);
|
||||
IBlockState state = this.world.getBlockState(offset);
|
||||
BlockState state = this.world.getBlockState(offset);
|
||||
if (NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().containsKey(state))
|
||||
possibleOffsets.add(offset);
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable
|
|||
if (possibleOffsets.isEmpty())
|
||||
return;
|
||||
BlockPos offset = possibleOffsets.get(this.world.rand.nextInt(possibleOffsets.size()));
|
||||
IBlockState state = this.world.getBlockState(offset);
|
||||
IBlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().get(state);
|
||||
BlockState state = this.world.getBlockState(offset);
|
||||
BlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().get(state);
|
||||
|
||||
int toAdd = 7500;
|
||||
if (this.canGenerateRightNow(35, toAdd)) {
|
||||
|
|
|
@ -10,19 +10,19 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
|||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int bobTimer;
|
||||
|
||||
private final BasicAuraContainer container = new BasicAuraContainer(NaturesAuraAPI.TYPE_OVERWORLD, 500000);
|
||||
|
@ -71,7 +71,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
|
|||
for (int x = -2; x <= 2; x += 4) {
|
||||
for (int z = -2; z <= 2; z += 4) {
|
||||
BlockPos offset = this.pos.add(x, 1, z);
|
||||
IBlockState state = this.world.getBlockState(offset);
|
||||
BlockState state = this.world.getBlockState(offset);
|
||||
this.catalysts[index] = state.getBlock().getItem(this.world, offset, state);
|
||||
index++;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
compound.setTag("items", this.items.serializeNBT());
|
||||
|
@ -222,7 +222,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
this.items.deserializeNBT(compound.getCompoundTag("items"));
|
||||
|
@ -238,12 +238,12 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IAuraContainer getAuraContainer(EnumFacing facing) {
|
||||
public IAuraContainer getAuraContainer(Direction facing) {
|
||||
return this.container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.LogBlock;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickable
|
|||
if (!this.world.isRemote)
|
||||
while (!this.scheduledBigTrees.isEmpty()) {
|
||||
BlockPos pos = this.scheduledBigTrees.remove();
|
||||
if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) {
|
||||
if (this.world.getBlockState(pos).getBlock() instanceof LogBlock) {
|
||||
int toAdd = 100000;
|
||||
boolean canGen = this.canGenerateRightNow(25, toAdd);
|
||||
if (canGen)
|
||||
|
|
|
@ -6,13 +6,13 @@ import de.ellpeck.naturesaura.api.recipes.OfferingRecipe;
|
|||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.effect.LightningBoltEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
@ -42,7 +42,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
if (stack.isEmpty())
|
||||
return;
|
||||
|
||||
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos).grow(1));
|
||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos).grow(1));
|
||||
if (items.isEmpty())
|
||||
return;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
if (recipe == null)
|
||||
return;
|
||||
|
||||
for (EntityItem item : items) {
|
||||
for (ItemEntity item : items) {
|
||||
if (item.isDead || item.cannotPickup())
|
||||
continue;
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
for (int i = 0; i < recipeCount; i++)
|
||||
this.itemsToSpawn.add(recipe.output.copy());
|
||||
|
||||
this.world.addWeatherEffect(new EntityLightningBolt(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true));
|
||||
this.world.addWeatherEffect(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true));
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
(float) item.posX, (float) item.posY, (float) item.posZ, 13,
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ()));
|
||||
|
@ -79,7 +79,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
}
|
||||
} else if (this.world.getTotalWorldTime() % 3 == 0) {
|
||||
if (!this.itemsToSpawn.isEmpty())
|
||||
this.world.spawnEntity(new EntityItem(
|
||||
this.world.spawnEntity(new ItemEntity(
|
||||
this.world,
|
||||
this.pos.getX() + 0.5F, 256, this.pos.getZ() + 0.5F,
|
||||
this.itemsToSpawn.remove()));
|
||||
|
@ -95,13 +95,13 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
compound.setTag("items", this.items.serializeNBT());
|
||||
|
||||
if (type != SaveType.SYNC) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
ListNBT list = new ListNBT();
|
||||
for (ItemStack stack : this.itemsToSpawn) {
|
||||
list.appendTag(stack.serializeNBT());
|
||||
}
|
||||
|
@ -111,23 +111,23 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
this.items.deserializeNBT(compound.getCompoundTag("items"));
|
||||
|
||||
if (type != SaveType.SYNC) {
|
||||
this.itemsToSpawn.clear();
|
||||
NBTTagList list = compound.getTagList("items_to_spawn", 10);
|
||||
ListNBT list = compound.getTagList("items_to_spawn", 10);
|
||||
for (NBTBase base : list) {
|
||||
this.itemsToSpawn.add(new ItemStack((NBTTagCompound) base));
|
||||
this.itemsToSpawn.add(new ItemStack((CompoundNBT) base));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ import de.ellpeck.naturesaura.blocks.ModBlocks;
|
|||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
@ -35,12 +35,12 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable {
|
|||
if (this.redstonePower > 0)
|
||||
return;
|
||||
TileEntity tileUp = this.world.getTileEntity(this.pos.up());
|
||||
if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
|
||||
if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN))
|
||||
return;
|
||||
IItemHandler handler = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
|
||||
IItemHandler handler = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN);
|
||||
if (handler == null)
|
||||
return;
|
||||
List<EntityItemFrame> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
List<ItemFrameEntity> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
if (frames.isEmpty())
|
||||
return;
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable {
|
|||
continue;
|
||||
|
||||
BlockPos up = pos.up();
|
||||
IBlockState state = this.world.getBlockState(up);
|
||||
BlockState state = this.world.getBlockState(up);
|
||||
if (state.getBlock().isReplaceable(this.world, up))
|
||||
validPositions.add(up);
|
||||
}
|
||||
|
@ -82,12 +82,12 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean framesContain(List<EntityItemFrame> frames, BlockPos pos, IBlockState state) {
|
||||
private boolean framesContain(List<ItemFrameEntity> frames, BlockPos pos, BlockState state) {
|
||||
ItemStack stack = state.getBlock().getItem(this.world, pos, state);
|
||||
if (stack.isEmpty())
|
||||
return false;
|
||||
|
||||
for (EntityItemFrame frame : frames) {
|
||||
for (ItemFrameEntity frame : frames) {
|
||||
ItemStack frameStack = frame.getDisplayedItem();
|
||||
if (frameStack.isEmpty())
|
||||
continue;
|
||||
|
@ -104,13 +104,13 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable {
|
|||
if (this.handleSpecialCases(stack, pos))
|
||||
return stack;
|
||||
|
||||
if (!(this.world instanceof WorldServer))
|
||||
if (!(this.world instanceof ServerWorld))
|
||||
return stack;
|
||||
|
||||
FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) this.world);
|
||||
FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) this.world);
|
||||
fake.inventory.mainInventory.set(fake.inventory.currentItem, stack);
|
||||
fake.interactionManager.processRightClickBlock(fake, this.world, fake.getHeldItemMainhand(), EnumHand.MAIN_HAND,
|
||||
pos, EnumFacing.DOWN, 0.5F, 0.5F, 0.5F);
|
||||
fake.interactionManager.processRightClickBlock(fake, this.world, fake.getHeldItemMainhand(), Hand.MAIN_HAND,
|
||||
pos, Direction.DOWN, 0.5F, 0.5F, 0.5F);
|
||||
return fake.getHeldItemMainhand().copy();
|
||||
}
|
||||
|
||||
|
@ -127,10 +127,10 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable {
|
|||
return false;
|
||||
else if (stack.getItem() instanceof IPlantable) {
|
||||
IPlantable plantable = (IPlantable) stack.getItem();
|
||||
IBlockState plant = plantable.getPlant(this.world, pos);
|
||||
BlockState plant = plantable.getPlant(this.world, pos);
|
||||
if (!plant.getBlock().canPlaceBlockAt(this.world, pos))
|
||||
return false;
|
||||
IBlockState state = this.world.getBlockState(pos);
|
||||
BlockState state = this.world.getBlockState(pos);
|
||||
if (!state.getBlock().isAir(state, this.world, pos))
|
||||
return false;
|
||||
this.world.setBlockState(pos, plant);
|
||||
|
|
|
@ -4,10 +4,10 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.entity.EntityAreaEffectCloud;
|
||||
import net.minecraft.entity.AreaEffectCloudEntity;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.potion.PotionUtils;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -24,18 +24,18 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab
|
|||
if (Multiblocks.POTION_GENERATOR.isComplete(this.world, this.pos)) {
|
||||
boolean addedOne = false;
|
||||
|
||||
List<EntityAreaEffectCloud> clouds = this.world.getEntitiesWithinAABB(EntityAreaEffectCloud.class, new AxisAlignedBB(this.pos).grow(2));
|
||||
for (EntityAreaEffectCloud cloud : clouds) {
|
||||
List<AreaEffectCloudEntity> clouds = this.world.getEntitiesWithinAABB(AreaEffectCloudEntity.class, new AxisAlignedBB(this.pos).grow(2));
|
||||
for (AreaEffectCloudEntity cloud : clouds) {
|
||||
if (cloud.isDead)
|
||||
continue;
|
||||
|
||||
if (!addedOne) {
|
||||
PotionType type = ReflectionHelper.getPrivateValue(EntityAreaEffectCloud.class, cloud, "field_184502_e", "potion");
|
||||
Potion type = ReflectionHelper.getPrivateValue(AreaEffectCloudEntity.class, cloud, "field_184502_e", "potion");
|
||||
if (type == null)
|
||||
continue;
|
||||
|
||||
for (PotionEffect effect : type.getEffects()) {
|
||||
Potion potion = effect.getPotion();
|
||||
for (EffectInstance effect : type.getEffects()) {
|
||||
Effect potion = effect.getPotion();
|
||||
if (potion.isBadEffect() || potion.isInstant()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
|
|||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EntityPredicates;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
@ -18,8 +18,8 @@ public class TileEntityPowderPlacer extends TileEntityImpl {
|
|||
public void onRedstonePowerChange(int newPower) {
|
||||
if (this.redstonePower <= 0 && newPower > 0) {
|
||||
List<EntityEffectInhibitor> powders = this.world.getEntitiesWithinAABB(EntityEffectInhibitor.class,
|
||||
new AxisAlignedBB(this.pos, this.pos.add(1, 2, 1)), EntitySelectors.IS_ALIVE);
|
||||
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
|
||||
new AxisAlignedBB(this.pos, this.pos.add(1, 2, 1)), EntityPredicates.IS_ALIVE);
|
||||
for (Direction facing : Direction.HORIZONTALS) {
|
||||
TileEntity tile = this.world.getTileEntity(this.pos.offset(facing));
|
||||
if (tile == null || !tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()))
|
||||
continue;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
|
||||
public class TileEntityProjectileGenerator extends TileEntityImpl {
|
||||
|
||||
public EnumFacing nextSide = EnumFacing.NORTH;
|
||||
public Direction nextSide = Direction.NORTH;
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
compound.setInteger("next_side", this.nextSide.getHorizontalIndex());
|
||||
|
@ -17,10 +17,10 @@ public class TileEntityProjectileGenerator extends TileEntityImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK) {
|
||||
this.nextSide = EnumFacing.byHorizontalIndex(compound.getInteger("next_side"));
|
||||
this.nextSide = Direction.byHorizontalIndex(compound.getInteger("next_side"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -24,13 +24,13 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickable {
|
|||
private int lastEnergy;
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
compound.setInteger("energy", this.storage.getEnergyStored());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
this.storage.setEnergy(compound.getInteger("energy"));
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickable {
|
|||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
for (Direction facing : Direction.VALUES) {
|
||||
TileEntity tile = this.world.getTileEntity(this.pos.offset(facing));
|
||||
if (tile == null || !tile.hasCapability(CapabilityEnergy.ENERGY, facing.getOpposite()))
|
||||
continue;
|
||||
|
@ -84,13 +84,13 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable Direction facing) {
|
||||
return capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable Direction facing) {
|
||||
if (capability == CapabilityEnergy.ENERGY)
|
||||
return (T) this.storage;
|
||||
else
|
||||
|
|
|
@ -5,19 +5,19 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityItemFrame;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.play.server.SPacketTimeUpdate;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.play.server.SUpdateTimePacket;
|
||||
import net.minecraft.server.management.PlayerList;
|
||||
import net.minecraft.util.EntitySelectors;
|
||||
import net.minecraft.util.EntityPredicates;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,8 +28,8 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable {
|
|||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
List<EntityItemFrame> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
for (EntityItemFrame frame : frames) {
|
||||
List<ItemFrameEntity> frames = Helper.getAttachedItemFrames(this.world, this.pos);
|
||||
for (ItemFrameEntity frame : frames) {
|
||||
ItemStack frameStack = frame.getDisplayedItem();
|
||||
if (frameStack.isEmpty() || frameStack.getItem() != ModItems.CLOCK_HAND)
|
||||
continue;
|
||||
|
@ -47,9 +47,9 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable {
|
|||
BlockPos spot = IAuraChunk.getHighestSpot(this.world, this.pos, 35, this.pos);
|
||||
IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, (int) toAdd * 20);
|
||||
|
||||
if (this.world instanceof WorldServer) {
|
||||
if (this.world instanceof ServerWorld) {
|
||||
PlayerList list = this.world.getMinecraftServer().getPlayerList();
|
||||
list.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate(
|
||||
list.sendPacketToAllPlayersInDimension(new SUpdateTimePacket(
|
||||
this.world.getTotalWorldTime(), this.world.getWorldTime(),
|
||||
this.world.getGameRules().getBoolean("doDaylightCycle")), this.world.provider.getDimension());
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable {
|
|||
if (this.world.getTotalWorldTime() % 20 != 0)
|
||||
return;
|
||||
|
||||
List<EntityItem> items = this.world.getEntitiesWithinAABB(EntityItem.class,
|
||||
new AxisAlignedBB(this.pos).grow(1), EntitySelectors.IS_ALIVE);
|
||||
for (EntityItem item : items) {
|
||||
List<ItemEntity> items = this.world.getEntitiesWithinAABB(ItemEntity.class,
|
||||
new AxisAlignedBB(this.pos).grow(1), EntityPredicates.IS_ALIVE);
|
||||
for (ItemEntity item : items) {
|
||||
if (item.cannotPickup())
|
||||
continue;
|
||||
ItemStack stack = item.getItem();
|
||||
|
@ -106,14 +106,14 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK)
|
||||
compound.setLong("goal", this.goalTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK)
|
||||
this.goalTime = compound.getLong("goal");
|
||||
|
|
|
@ -6,16 +6,16 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
|||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticleStream;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.block.LogBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
|
@ -80,7 +80,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
return true;
|
||||
});
|
||||
|
||||
EntityItem item = new EntityItem(this.world,
|
||||
ItemEntity item = new ItemEntity(this.world,
|
||||
this.ritualPos.getX() + 0.5, this.ritualPos.getY() + 4.5, this.ritualPos.getZ() + 0.5,
|
||||
this.recipe.result.copy());
|
||||
this.world.spawnEntity(item);
|
||||
|
@ -133,8 +133,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
BlockPos offset = pos.add(x, y, z);
|
||||
IBlockState state = this.world.getBlockState(offset);
|
||||
if (state.getBlock() instanceof BlockLog || state.getBlock() instanceof BlockLeaves) {
|
||||
BlockState state = this.world.getBlockState(offset);
|
||||
if (state.getBlock() instanceof LogBlock || state.getBlock() instanceof LeavesBlock) {
|
||||
this.world.setBlockToAir(offset);
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 2));
|
||||
|
||||
|
@ -150,8 +150,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
return false;
|
||||
}
|
||||
for (int i = 0; i < 2; i++) {
|
||||
IBlockState state = this.world.getBlockState(this.ritualPos.up(i));
|
||||
if(!(state.getBlock() instanceof BlockLog))
|
||||
BlockState state = this.world.getBlockState(this.ritualPos.up(i));
|
||||
if(!(state.getBlock() instanceof LogBlock))
|
||||
return false;
|
||||
}
|
||||
if (this.timer < this.recipe.time / 2) {
|
||||
|
@ -179,7 +179,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void writeNBT(CompoundNBT compound, SaveType type) {
|
||||
super.writeNBT(compound, type);
|
||||
if (type != SaveType.BLOCK)
|
||||
compound.setTag("items", this.items.serializeNBT());
|
||||
|
@ -194,7 +194,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(NBTTagCompound compound, SaveType type) {
|
||||
public void readNBT(CompoundNBT compound, SaveType type) {
|
||||
super.readNBT(compound, type);
|
||||
if (type != SaveType.BLOCK)
|
||||
this.items.deserializeNBT(compound.getCompoundTag("items"));
|
||||
|
@ -209,7 +209,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IItemHandlerModifiable getItemHandler(EnumFacing facing) {
|
||||
public IItemHandlerModifiable getItemHandler(Direction facing) {
|
||||
return this.items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,19 +4,19 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Random;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderEnderCrate extends TileEntitySpecialRenderer<TileEntityEnderCrate> {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
|
||||
private static final ResourceLocation END_SKY_TEXTURE = new ResourceLocation("textures/environment/end_sky.png");
|
||||
private static final ResourceLocation END_PORTAL_TEXTURE = new ResourceLocation("textures/entity/end_portal.png");
|
||||
private static final Random RANDOM = new Random(31100L);
|
||||
|
|
|
@ -6,17 +6,17 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderGeneratorLimitRemover extends TileEntitySpecialRenderer<TileEntityGeneratorLimitRemover> {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGeneratorLimitRemover> {
|
||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/generator_limit_remover_glint.png");
|
||||
private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint();
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RenderNatureAltar extends TileEntitySpecialRenderer<TileEntityNatureAltar> {
|
||||
public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> {
|
||||
@Override
|
||||
public void render(TileEntityNatureAltar tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
||||
ItemStack stack = tile.items.getStackInSlot(0);
|
||||
|
@ -17,7 +17,7 @@ public class RenderNatureAltar extends TileEntitySpecialRenderer<TileEntityNatur
|
|||
float bob = (float) Math.sin(time / 10F) * 0.1F;
|
||||
GlStateManager.translate(x + 0.5F, y + 1.2F + bob, z + 0.5F);
|
||||
GlStateManager.rotate((time * 3) % 360, 0F, 1F, 0F);
|
||||
float scale = stack.getItem() instanceof ItemBlock ? 0.75F : 0.5F;
|
||||
float scale = stack.getItem() instanceof BlockItem ? 0.75F : 0.5F;
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
Helper.renderItemInWorld(stack);
|
||||
GlStateManager.popMatrix();
|
||||
|
|
|
@ -2,17 +2,17 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RenderOfferingTable extends TileEntitySpecialRenderer<TileEntityOfferingTable> {
|
||||
public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTable> {
|
||||
|
||||
private final Random rand = new Random();
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class RenderOfferingTable extends TileEntitySpecialRenderer<TileEntityOff
|
|||
|
||||
float scale;
|
||||
float yOff;
|
||||
if (item instanceof ItemBlock && ((ItemBlock) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) {
|
||||
if (item instanceof BlockItem && ((BlockItem) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) {
|
||||
scale = 0.4F;
|
||||
yOff = 0.08F;
|
||||
} else {
|
||||
|
|
|
@ -4,16 +4,16 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderProjectileGenerator extends TileEntitySpecialRenderer<TileEntityProjectileGenerator> {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderProjectileGenerator extends TileEntityRenderer<TileEntityProjectileGenerator> {
|
||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png");
|
||||
private final ModelOverlay model = new ModelOverlay();
|
||||
|
||||
|
@ -21,13 +21,13 @@ public class RenderProjectileGenerator extends TileEntitySpecialRenderer<TileEnt
|
|||
public void render(TileEntityProjectileGenerator te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(x, y, z);
|
||||
if (te.nextSide == EnumFacing.NORTH) {
|
||||
if (te.nextSide == Direction.NORTH) {
|
||||
GlStateManager.rotate(270, 0, 1, 0);
|
||||
GlStateManager.translate(-0.001F, 0, -1);
|
||||
} else if (te.nextSide == EnumFacing.EAST) {
|
||||
} else if (te.nextSide == Direction.EAST) {
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
GlStateManager.translate(-1.001F, 0, -1);
|
||||
} else if (te.nextSide == EnumFacing.SOUTH) {
|
||||
} else if (te.nextSide == Direction.SOUTH) {
|
||||
GlStateManager.rotate(90, 0, 1, 0);
|
||||
GlStateManager.translate(-1.001F, 0, 0);
|
||||
} else {
|
||||
|
|
|
@ -2,21 +2,21 @@ package de.ellpeck.naturesaura.blocks.tiles.render;
|
|||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
|
||||
public class RenderWoodStand extends TileEntitySpecialRenderer<TileEntityWoodStand> {
|
||||
public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {
|
||||
@Override
|
||||
public void render(TileEntityWoodStand tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
||||
ItemStack stack = tile.items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof ItemBlock && ((ItemBlock) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) {
|
||||
if (item instanceof BlockItem && ((BlockItem) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) {
|
||||
GlStateManager.translate(x + 0.5F, y + 0.9735F, z + 0.5F);
|
||||
float scale = 0.65F;
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
|
|
@ -6,11 +6,11 @@ import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
|||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.packet.PacketAuraChunk;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -173,7 +173,7 @@ public class AuraChunk implements IAuraChunk {
|
|||
}
|
||||
}
|
||||
|
||||
public void getActiveEffectIcons(EntityPlayer player, Map<ResourceLocation, Tuple<ItemStack, Boolean>> icons) {
|
||||
public void getActiveEffectIcons(PlayerEntity player, Map<ResourceLocation, Tuple<ItemStack, Boolean>> icons) {
|
||||
for (IDrainSpotEffect effect : this.effects) {
|
||||
Tuple<ItemStack, Boolean> alreadyThere = icons.get(effect.getName());
|
||||
if (alreadyThere != null && alreadyThere.getSecond())
|
||||
|
@ -193,26 +193,26 @@ public class AuraChunk implements IAuraChunk {
|
|||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT() {
|
||||
NBTTagList list = new NBTTagList();
|
||||
public CompoundNBT serializeNBT() {
|
||||
ListNBT list = new ListNBT();
|
||||
for (Map.Entry<BlockPos, MutableInt> entry : this.drainSpots.entrySet()) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
CompoundNBT tag = new CompoundNBT();
|
||||
tag.setLong("pos", entry.getKey().toLong());
|
||||
tag.setInteger("amount", entry.getValue().intValue());
|
||||
list.appendTag(tag);
|
||||
}
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
compound.setTag("drain_spots", list);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT(NBTTagCompound compound) {
|
||||
public void deserializeNBT(CompoundNBT compound) {
|
||||
this.drainSpots.clear();
|
||||
NBTTagList list = compound.getTagList("drain_spots", 10);
|
||||
ListNBT list = compound.getTagList("drain_spots", 10);
|
||||
for (NBTBase base : list) {
|
||||
NBTTagCompound tag = (NBTTagCompound) base;
|
||||
CompoundNBT tag = (CompoundNBT) base;
|
||||
this.addDrainSpot(
|
||||
BlockPos.fromLong(tag.getLong("pos")),
|
||||
new MutableInt(tag.getInteger("amount")));
|
||||
|
|
|
@ -3,8 +3,8 @@ package de.ellpeck.naturesaura.chunk;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
@ -13,7 +13,7 @@ import net.minecraftforge.common.util.INBTSerializable;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class AuraChunkProvider implements ICapabilityProvider, INBTSerializable<NBTTagCompound> {
|
||||
public class AuraChunkProvider implements ICapabilityProvider, INBTSerializable<CompoundNBT> {
|
||||
|
||||
private final Chunk chunk;
|
||||
private IAuraChunk auraChunk;
|
||||
|
@ -29,23 +29,23 @@ public class AuraChunkProvider implements ICapabilityProvider, INBTSerializable<
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) {
|
||||
return capability == NaturesAuraAPI.capAuraChunk;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
|
||||
return capability == NaturesAuraAPI.capAuraChunk ? (T) this.getAuraChunk() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT() {
|
||||
public CompoundNBT serializeNBT() {
|
||||
return this.getAuraChunk().serializeNBT();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT(NBTTagCompound nbt) {
|
||||
public void deserializeNBT(CompoundNBT nbt) {
|
||||
this.getAuraChunk().deserializeNBT(nbt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,12 +6,12 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityChicken;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemEgg;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
import net.minecraft.entity.passive.ChickenEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.EggItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -48,7 +48,7 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.world, pos, spot))
|
||||
return -1;
|
||||
if (!this.bb.contains(player.getPositionVector()))
|
||||
|
@ -68,23 +68,23 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
if (!this.calcValues(world, pos, spot))
|
||||
return;
|
||||
|
||||
List<EntityAnimal> animals = world.getEntitiesWithinAABB(EntityAnimal.class, this.bb);
|
||||
List<AnimalEntity> animals = world.getEntitiesWithinAABB(AnimalEntity.class, this.bb);
|
||||
if (animals.size() >= 200)
|
||||
return;
|
||||
|
||||
if (world.getTotalWorldTime() % 200 == 0) {
|
||||
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, this.bb);
|
||||
for (EntityItem item : items) {
|
||||
List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, this.bb);
|
||||
for (ItemEntity item : items) {
|
||||
if (item.isDead)
|
||||
continue;
|
||||
if (!NaturesAuraAPI.instance().isEffectPowderActive(world, item.getPosition(), NAME))
|
||||
continue;
|
||||
|
||||
ItemStack stack = item.getItem();
|
||||
if (!(stack.getItem() instanceof ItemEgg))
|
||||
if (!(stack.getItem() instanceof EggItem))
|
||||
continue;
|
||||
// The getAge() method is private for absolutely no reason but I want it so I don't care
|
||||
int age = ReflectionHelper.getPrivateValue(EntityItem.class, item, "field_70292_b", "age");
|
||||
int age = ReflectionHelper.getPrivateValue(ItemEntity.class, item, "field_70292_b", "age");
|
||||
if (age < item.lifespan / 2)
|
||||
continue;
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
item.setItem(stack);
|
||||
}
|
||||
|
||||
EntityChicken chicken = new EntityChicken(world);
|
||||
ChickenEntity chicken = new ChickenEntity(world);
|
||||
chicken.setGrowingAge(-24000);
|
||||
chicken.setPosition(item.posX, item.posY, item.posZ);
|
||||
world.spawnEntity(chicken);
|
||||
|
@ -108,18 +108,18 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
if (world.rand.nextInt(200) <= this.chance) {
|
||||
if (animals.size() < 2)
|
||||
return;
|
||||
EntityAnimal first = animals.get(world.rand.nextInt(animals.size()));
|
||||
AnimalEntity first = animals.get(world.rand.nextInt(animals.size()));
|
||||
if (first.isChild() || first.isInLove())
|
||||
return;
|
||||
if (!NaturesAuraAPI.instance().isEffectPowderActive(world, first.getPosition(), NAME))
|
||||
return;
|
||||
|
||||
Optional<EntityAnimal> secondOptional = animals.stream()
|
||||
Optional<AnimalEntity> secondOptional = animals.stream()
|
||||
.filter(e -> e != first && !e.isInLove() && !e.isChild())
|
||||
.min(Comparator.comparingDouble(e -> e.getDistanceSq(first)));
|
||||
if (!secondOptional.isPresent())
|
||||
return;
|
||||
EntityAnimal second = secondOptional.get();
|
||||
AnimalEntity second = secondOptional.get();
|
||||
if (second.getDistanceSq(first) > 5 * 5)
|
||||
return;
|
||||
|
||||
|
@ -131,7 +131,7 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
private void setInLove(EntityAnimal animal) {
|
||||
private void setInLove(AnimalEntity animal) {
|
||||
animal.setInLove(null);
|
||||
for (int j = 0; j < 7; j++)
|
||||
animal.world.spawnParticle(EnumParticleTypes.HEART,
|
||||
|
|
|
@ -7,11 +7,11 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.potion.ModPotions;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.EffectInstance;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -43,7 +43,7 @@ public class BreathlessEffect implements IDrainSpotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.world, pos, spot))
|
||||
return -1;
|
||||
if (!this.bb.contains(player.getPositionVector()))
|
||||
|
@ -62,9 +62,9 @@ public class BreathlessEffect implements IDrainSpotEffect {
|
|||
return;
|
||||
if (!this.calcValues(world, pos, spot))
|
||||
return;
|
||||
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, this.bb);
|
||||
for (EntityLivingBase entity : entities)
|
||||
entity.addPotionEffect(new PotionEffect(ModPotions.BREATHLESS, 300, this.amp));
|
||||
List<LivingEntity> entities = world.getEntitiesWithinAABB(LivingEntity.class, this.bb);
|
||||
for (LivingEntity entity : entities)
|
||||
entity.addPotionEffect(new EffectInstance(ModPotions.BREATHLESS, 300, this.amp));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,7 +7,7 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -38,7 +38,7 @@ public class CacheRechargeEffect implements IDrainSpotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.world, pos, spot))
|
||||
return -1;
|
||||
if (!this.bb.contains(player.getPositionVector()))
|
||||
|
@ -57,8 +57,8 @@ public class CacheRechargeEffect implements IDrainSpotEffect {
|
|||
public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(world, pos, spot))
|
||||
return;
|
||||
List<EntityPlayer> players = world.getEntitiesWithinAABB(EntityPlayer.class, this.bb);
|
||||
for (EntityPlayer player : players) {
|
||||
List<PlayerEntity> players = world.getEntitiesWithinAABB(PlayerEntity.class, this.bb);
|
||||
for (PlayerEntity player : players) {
|
||||
if (NaturesAuraAPI.instance().isEffectPowderActive(world, player.getPosition(), NAME))
|
||||
continue;
|
||||
if (NaturesAuraAPI.instance().insertAuraIntoPlayer(player, this.amount, true)) {
|
||||
|
|
|
@ -5,8 +5,8 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -38,7 +38,7 @@ public class ExplosionEffect implements IDrainSpotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.world, pos, spot))
|
||||
return -1;
|
||||
if (player.getDistanceSq(pos) > this.dist * this.dist)
|
||||
|
|
|
@ -8,9 +8,9 @@ import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
|||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -40,7 +40,7 @@ public class GrassDieEffect implements IDrainSpotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.world, pos, spot))
|
||||
return -1;
|
||||
if (player.getDistanceSq(pos) > this.dist * this.dist)
|
||||
|
@ -64,10 +64,10 @@ public class GrassDieEffect implements IDrainSpotEffect {
|
|||
pos.getZ() + world.rand.nextGaussian() * this.dist
|
||||
);
|
||||
if (grassPos.distanceSq(pos) <= this.dist * this.dist && world.isBlockLoaded(grassPos)) {
|
||||
IBlockState state = world.getBlockState(grassPos);
|
||||
BlockState state = world.getBlockState(grassPos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
IBlockState newState = null;
|
||||
BlockState newState = null;
|
||||
if (block instanceof BlockLeaves) {
|
||||
newState = ModBlocks.DECAYED_LEAVES.getDefaultState();
|
||||
} else if (block instanceof BlockGrass) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
|||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import de.ellpeck.naturesaura.api.recipes.WeightedOre;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -18,7 +18,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.ServerWorld;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
|
@ -30,7 +30,7 @@ import java.util.Set;
|
|||
|
||||
public class OreSpawnEffect implements IDrainSpotEffect {
|
||||
|
||||
public static final Set<IBlockState> SPAWN_EXCEPTIONS = new HashSet<>();
|
||||
public static final Set<BlockState> SPAWN_EXCEPTIONS = new HashSet<>();
|
||||
public static final ResourceLocation NAME = new ResourceLocation(NaturesAura.MOD_ID, "ore_spawn");
|
||||
|
||||
private int amount;
|
||||
|
@ -50,7 +50,7 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.world, pos, spot))
|
||||
return -1;
|
||||
if (player.getDistanceSq(pos) > this.dist * this.dist)
|
||||
|
@ -97,7 +97,7 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
|||
BlockPos orePos = new BlockPos(x, y, z);
|
||||
if (orePos.distanceSq(powderPos.x, powderPos.y, powderPos.z) <= range * range
|
||||
&& orePos.distanceSq(pos) <= this.dist * this.dist && world.isBlockLoaded(orePos)) {
|
||||
IBlockState state = world.getBlockState(orePos);
|
||||
BlockState state = world.getBlockState(orePos);
|
||||
Block block = state.getBlock();
|
||||
if (block != requiredBlock)
|
||||
continue;
|
||||
|
@ -113,8 +113,8 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
|||
if (toPlace == Blocks.AIR)
|
||||
continue;
|
||||
|
||||
FakePlayer player = FakePlayerFactory.getMinecraft((WorldServer) world);
|
||||
IBlockState stateToPlace = toPlace.getStateForPlacement(world, pos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), player, EnumHand.MAIN_HAND);
|
||||
FakePlayer player = FakePlayerFactory.getMinecraft((ServerWorld) world);
|
||||
BlockState stateToPlace = toPlace.getStateForPlacement(world, pos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), player, EnumHand.MAIN_HAND);
|
||||
if (SPAWN_EXCEPTIONS.contains(stateToPlace))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@ import de.ellpeck.naturesaura.packet.PacketHandler;
|
|||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -42,7 +42,7 @@ public class PlantBoostEffect implements IDrainSpotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
|
||||
if (!this.calcValues(player.world, pos, spot))
|
||||
return -1;
|
||||
if (player.getDistanceSq(pos) > this.dist * this.dist)
|
||||
|
@ -69,7 +69,7 @@ public class PlantBoostEffect implements IDrainSpotEffect {
|
|||
if (NaturesAuraAPI.instance().isEffectPowderActive(world, plantPos, NAME))
|
||||
continue;
|
||||
|
||||
IBlockState state = world.getBlockState(plantPos);
|
||||
BlockState state = world.getBlockState(plantPos);
|
||||
Block block = state.getBlock();
|
||||
if (block instanceof IGrowable &&
|
||||
block != Blocks.TALLGRASS && block != Blocks.GRASS && block != Blocks.DOUBLE_PLANT) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.NaturesAura;
|
|||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
|
||||
import de.ellpeck.naturesaura.api.aura.type.IAuraType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -23,7 +23,7 @@ public class SpreadEffect implements IDrainSpotEffect {
|
|||
while (toMove > 0) {
|
||||
BlockPos bestOffset = null;
|
||||
int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE;
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
for (Direction facing : Direction.VALUES) {
|
||||
BlockPos offset = pos.offset(facing, 15);
|
||||
if (world.isBlockLoaded(offset) && offset.getY() >= 0 && offset.getY() <= world.getHeight()) {
|
||||
int amount = IAuraChunk.getAuraInArea(world, offset, 14);
|
||||
|
|
|
@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import net.minecraft.command.*;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -38,7 +38,7 @@ public class CommandAura extends CommandBase {
|
|||
BlockPos spot = IAuraChunk.getLowestSpot(world, pos, range, pos);
|
||||
amount -= IAuraChunk.getAuraChunk(world, spot).storeAura(spot, amount);
|
||||
}
|
||||
sender.sendMessage(new TextComponentString("Stored Aura successfully"));
|
||||
sender.sendMessage(new StringTextComponent("Stored Aura successfully"));
|
||||
} else if ("drain".equals(action)) {
|
||||
int amount = parse(args, 1, -1);
|
||||
int range = parse(args, 2, 35);
|
||||
|
@ -46,7 +46,7 @@ public class CommandAura extends CommandBase {
|
|||
BlockPos spot = IAuraChunk.getHighestSpot(world, pos, range, pos);
|
||||
amount -= IAuraChunk.getAuraChunk(world, spot).drainAura(spot, amount);
|
||||
}
|
||||
sender.sendMessage(new TextComponentString("Drained Aura successfully"));
|
||||
sender.sendMessage(new StringTextComponent("Drained Aura successfully"));
|
||||
} else if ("reset".equals(action)) {
|
||||
int range = parse(args, 1, -1);
|
||||
IAuraChunk.getSpotsInArea(world, pos, range, (spot, amount) -> {
|
||||
|
@ -56,7 +56,7 @@ public class CommandAura extends CommandBase {
|
|||
else
|
||||
chunk.storeAura(spot, -amount);
|
||||
});
|
||||
sender.sendMessage(new TextComponentString("Reset Aura successfully"));
|
||||
sender.sendMessage(new StringTextComponent("Reset Aura successfully"));
|
||||
} else {
|
||||
throw new SyntaxErrorException("Invalid action " + action);
|
||||
}
|
||||
|
|
|
@ -5,15 +5,15 @@ import baubles.api.IBauble;
|
|||
import baubles.api.cap.BaublesCapabilities;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -37,13 +37,13 @@ public class BaublesCompat {
|
|||
private void addCap(AttachCapabilitiesEvent<ItemStack> event, IBauble type) {
|
||||
event.addCapability(new ResourceLocation(NaturesAura.MOD_ID, "bauble"), new ICapabilityProvider() {
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) {
|
||||
return capability == BaublesCapabilities.CAPABILITY_ITEM_BAUBLE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
|
||||
return capability == BaublesCapabilities.CAPABILITY_ITEM_BAUBLE ? (T) type : null;
|
||||
}
|
||||
});
|
||||
|
@ -65,12 +65,12 @@ public class BaublesCompat {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) {
|
||||
public boolean willAutoSync(ItemStack itemstack, LivingEntity player) {
|
||||
return this.sync;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack stack, EntityLivingBase player) {
|
||||
public void onWornTick(ItemStack stack, LivingEntity player) {
|
||||
stack.getItem().onUpdate(stack, player.world, player, -1, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@ import mezz.jei.api.ingredients.IIngredients;
|
|||
import mezz.jei.api.ingredients.VanillaTypes;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemMonsterPlacer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
|
|
|
@ -7,16 +7,16 @@ import de.ellpeck.naturesaura.compat.Compat;
|
|||
import de.ellpeck.naturesaura.events.ClientEvents;
|
||||
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
|
||||
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler.FancyInfo;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.patchouli.api.BookDrawScreenEvent;
|
||||
import vazkii.patchouli.api.PatchouliAPI;
|
||||
|
||||
|
@ -39,7 +39,7 @@ public final class PatchouliCompat {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void onBookDraw(BookDrawScreenEvent event) {
|
||||
if (event.book == null || !event.book.equals(BOOK))
|
||||
return;
|
||||
|
@ -51,7 +51,7 @@ public final class PatchouliCompat {
|
|||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
event.gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI);
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 469, 0, 43, 42, 512, 256);
|
||||
AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 469, 0, 43, 42, 512, 256);
|
||||
|
||||
if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 43 && event.mouseY < y + 42)
|
||||
GuiUtils.drawHoveringText(
|
||||
|
@ -69,15 +69,15 @@ public final class PatchouliCompat {
|
|||
GlStateManager.color(1, 1, 1, 1);
|
||||
event.gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI);
|
||||
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496, 44, 16, 18, 512, 256);
|
||||
AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 496, 44, 16, 18, 512, 256);
|
||||
if (info.tier == 1) {
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 16, 44, 16, 18, 512, 256);
|
||||
AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 496 - 16, 44, 16, 18, 512, 256);
|
||||
} else {
|
||||
float r = ((info.color >> 16) & 255) / 255F;
|
||||
float g = ((info.color >> 8) & 255) / 255F;
|
||||
float b = (info.color & 255) / 255F;
|
||||
GlStateManager.color(r, g, b);
|
||||
Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
}
|
||||
|
||||
if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 16 && event.mouseY < y + 18)
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.compat.patchouli;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemMonsterPlacer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
|
|
|
@ -11,7 +11,7 @@ import de.ellpeck.naturesaura.items.ModItems;
|
|||
import de.ellpeck.naturesaura.misc.WorldData;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
|
@ -23,8 +23,8 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
private static final DataParameter<Integer> COLOR = EntityDataManager.createKey(EntityEffectInhibitor.class, DataSerializers.VARINT);
|
||||
private static final DataParameter<Integer> AMOUNT = EntityDataManager.createKey(EntityEffectInhibitor.class, DataSerializers.VARINT);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int renderTicks;
|
||||
|
||||
public EntityEffectInhibitor(World worldIn) {
|
||||
|
@ -106,14 +106,14 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound compound) {
|
||||
protected void readEntityFromNBT(CompoundNBT compound) {
|
||||
this.setInhibitedEffect(new ResourceLocation(compound.getString("effect")));
|
||||
this.setColor(compound.getInteger("color"));
|
||||
this.setAmount(compound.hasKey("amount") ? compound.getInteger("amount") : 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound compound) {
|
||||
protected void writeEntityToNBT(CompoundNBT compound) {
|
||||
compound.setString("effect", this.getInhibitedEffect().toString());
|
||||
compound.setInteger("color", this.getColor());
|
||||
compound.setInteger("amount", this.getAmount());
|
||||
|
@ -184,13 +184,13 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
return Helper.aabb(this.getPositionVector()).grow(this.getAmount());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public int getVisualizationColor(World world, BlockPos pos) {
|
||||
return this.getColor();
|
||||
}
|
||||
|
|
|
@ -4,15 +4,15 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
|||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
import de.ellpeck.naturesaura.packet.PacketParticles;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagLong;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.LongNBT;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -25,7 +25,7 @@ import javax.annotation.Nullable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityMoverMinecart extends EntityMinecart {
|
||||
public class EntityMoverMinecart extends AbstractMinecartEntity {
|
||||
|
||||
private final List<BlockPos> spotOffsets = new ArrayList<>();
|
||||
private BlockPos lastPosition = BlockPos.ORIGIN;
|
||||
|
@ -103,27 +103,27 @@ public class EntityMoverMinecart extends EntityMinecart {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound compound) {
|
||||
protected void writeEntityToNBT(CompoundNBT compound) {
|
||||
super.writeEntityToNBT(compound);
|
||||
compound.setBoolean("active", this.isActive);
|
||||
compound.setLong("last_pos", this.lastPosition.toLong());
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
ListNBT list = new ListNBT();
|
||||
for (BlockPos offset : this.spotOffsets)
|
||||
list.appendTag(new NBTTagLong(offset.toLong()));
|
||||
list.appendTag(new LongNBT(offset.toLong()));
|
||||
compound.setTag("offsets", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound compound) {
|
||||
protected void readEntityFromNBT(CompoundNBT compound) {
|
||||
super.readEntityFromNBT(compound);
|
||||
this.isActive = compound.getBoolean("active");
|
||||
this.lastPosition = BlockPos.fromLong(compound.getLong("last_pos"));
|
||||
|
||||
this.spotOffsets.clear();
|
||||
NBTTagList list = compound.getTagList("offsets", Constants.NBT.TAG_LONG);
|
||||
ListNBT list = compound.getTagList("offsets", Constants.NBT.TAG_LONG);
|
||||
for (NBTBase base : list)
|
||||
this.spotOffsets.add(BlockPos.fromLong(((NBTTagLong) base).getLong()));
|
||||
this.spotOffsets.add(BlockPos.fromLong(((LongNBT) base).getLong()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -139,7 +139,7 @@ public class EntityMoverMinecart extends EntityMinecart {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getDisplayTile() {
|
||||
public BlockState getDisplayTile() {
|
||||
return Blocks.STONE.getDefaultState();
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue