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