mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
part 1
This commit is contained in:
parent
194407c7b4
commit
8737bc28f6
65 changed files with 426 additions and 383 deletions
|
@ -20,7 +20,7 @@ archivesBaseName = 'NaturesAura'
|
|||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'snapshot', version: '20190719-1.14.3'
|
||||
mappings channel: 'snapshot', version: '20200128-1.15.1'
|
||||
|
||||
runs {
|
||||
client {
|
||||
|
@ -97,7 +97,7 @@ dependencies {
|
|||
compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2")
|
||||
|
||||
//compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.14.4:5.0.1.162")
|
||||
compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.15.1:6.0.0.4")
|
||||
compile fg.deobf("vazkii.patchouli:Patchouli:1.1-25.4")
|
||||
|
||||
runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.naturesaura;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.container.IAuraContainer;
|
||||
import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge;
|
||||
|
@ -13,7 +14,6 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -127,34 +127,35 @@ public final class Helper {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderItemInWorld(ItemStack stack) {
|
||||
if (!stack.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
// TODO rendering items in world
|
||||
/* if (!stack.isEmpty()) {
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.disableLighting();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.FIXED);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
RenderSystem.enableLighting();
|
||||
RenderSystem.popMatrix();
|
||||
}*/
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void renderItemInGui(ItemStack stack, int x, int y, float scale) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderHelper.setupGuiFlatDiffuseLighting();
|
||||
GlStateManager.enableDepthTest();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.translatef(x, y, 0);
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
RenderSystem.enableRescaleNormal();
|
||||
RenderSystem.translatef(x, y, 0);
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(stack, 0, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemOverlayIntoGUI(Minecraft.getInstance().fontRenderer, stack, 0, 0, null);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
public static boolean putStackOnTile(PlayerEntity player, Hand hand, BlockPos pos, int slot, boolean sound) {
|
||||
public static ActionResultType putStackOnTile(PlayerEntity player, Hand hand, BlockPos pos, int slot, boolean sound) {
|
||||
TileEntity tile = player.world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl) {
|
||||
IItemHandlerModifiable handler = ((TileEntityImpl) tile).getItemHandler(null);
|
||||
|
@ -168,7 +169,7 @@ public final class Helper {
|
|||
SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM, SoundCategory.PLAYERS, 0.75F, 1F);
|
||||
if (!player.world.isRemote)
|
||||
player.setHeldItem(hand, remain);
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,16 +180,16 @@ public final class Helper {
|
|||
if (!player.world.isRemote) {
|
||||
ItemStack stack = handler.getStackInSlot(slot);
|
||||
if (!player.addItemStackToInventory(stack)) {
|
||||
ItemEntity item = new ItemEntity(player.world, player.posX, player.posY, player.posZ, stack);
|
||||
ItemEntity item = new ItemEntity(player.world, player.getPosX(), player.getPosY(), player.getPosZ(), stack);
|
||||
player.world.addEntity(item);
|
||||
}
|
||||
handler.setStackInSlot(slot, ItemStack.EMPTY);
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
public static ICapabilityProvider makeRechargeProvider(ItemStack stack, boolean needsSelected) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package de.ellpeck.naturesaura.api.recipes.ing;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.crafting.IngredientNBT;
|
||||
|
||||
public class NBTIngredient extends IngredientNBT {
|
||||
public class NBTIngredient extends net.minecraftforge.common.crafting.NBTIngredient {
|
||||
public NBTIngredient(ItemStack stack) {
|
||||
super(stack);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -78,7 +79,7 @@ public class BlockAncientLeaves extends LeavesBlock implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
|
||||
super.tick(state, worldIn, pos, random);
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -31,7 +32,7 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte
|
|||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||
if (!world.isRemote) {
|
||||
super.randomTick(state, world, pos, random);
|
||||
|
||||
|
@ -62,7 +63,7 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte
|
|||
}
|
||||
|
||||
@Override
|
||||
public void grow(World world, Random rand, BlockPos pos, BlockState state) {
|
||||
public void grow(ServerWorld world, Random rand, BlockPos pos, BlockState state) {
|
||||
if (state.get(SaplingBlock.STAGE) == 0) {
|
||||
world.setBlockState(pos, state.cycle(SaplingBlock.STAGE), 4);
|
||||
} else if (ForgeEventFactory.saplingGrowTree(world, rand, pos)) {
|
||||
|
|
|
@ -73,7 +73,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
|
|||
|
||||
BlockPos genPos = gen.getPos();
|
||||
PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles(
|
||||
(float) entity.posX, (float) entity.posY, (float) entity.posZ, PacketParticles.Type.ANIMAL_GEN_CONSUME,
|
||||
(float) entity.getPosX(), (float) entity.getPosY(), (float) entity.getPosZ(), PacketParticles.Type.ANIMAL_GEN_CONSUME,
|
||||
child ? 1 : 0,
|
||||
(int) (entity.getEyeHeight() * 10F),
|
||||
genPos.getX(), genPos.getY(), genPos.getZ()));
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraft.world.IBlockReader;
|
|||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraft.world.storage.loot.LootContext;
|
||||
import net.minecraft.world.storage.loot.LootParameters;
|
||||
|
||||
|
@ -126,7 +127,7 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem, IMod
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityImpl) {
|
||||
|
|
|
@ -4,11 +4,8 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -19,15 +16,10 @@ public class BlockDecayedLeaves extends BlockImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
public void tick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||
if (!world.isRemote) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import net.minecraft.state.IProperty;
|
|||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
|
@ -66,16 +67,16 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() == ModItems.RANGE_VISUALIZER) {
|
||||
if (!worldIn.isRemote) {
|
||||
BlockPos goalPos = this.getGoalCoords(worldIn, pos);
|
||||
PacketHandler.sendTo(player, new PacketClient(0, this.goalDim, goalPos.getX(), goalPos.getY(), goalPos.getZ()));
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks;
|
|||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.misc.IWorldData;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
|
@ -11,6 +12,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -20,6 +22,8 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.Items;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -41,6 +45,7 @@ import javax.annotation.Nullable;
|
|||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
|
@ -103,7 +108,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityEnderCrate) {
|
||||
|
@ -114,7 +119,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,8 +145,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityEnderCrate.class, new RenderEnderCrate());
|
||||
public Tuple<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.ENDER_CRATE, RenderEnderCrate::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks;
|
|||
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
|
@ -10,7 +9,7 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
|
@ -28,13 +27,13 @@ public class BlockFieldCreator extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult p_225533_6_) {
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFieldCreator) {
|
||||
if (!worldIn.isRemote) {
|
||||
String key = NaturesAura.MOD_ID + ":field_creator_pos";
|
||||
CompoundNBT compound = player.getPersistentData();
|
||||
if (!player.isSneaking() && compound.contains(key)) {
|
||||
if (!player.isShiftKeyDown() && compound.contains(key)) {
|
||||
BlockPos stored = BlockPos.fromLong(compound.getLong(key));
|
||||
TileEntityFieldCreator creator = (TileEntityFieldCreator) tile;
|
||||
if (!pos.equals(stored)) {
|
||||
|
@ -63,9 +62,9 @@ public class BlockFieldCreator extends BlockContainerImpl {
|
|||
player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos"), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
} else
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,19 +89,8 @@ public class BlockFieldCreator extends BlockContainerImpl {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,11 +82,6 @@ public class BlockFurnaceHeater extends BlockContainerImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(BlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
builder.add(FACING);
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
package de.ellpeck.naturesaura.blocks;
|
||||
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
public BlockGeneratorLimitRemover() {
|
||||
|
@ -18,7 +24,7 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT
|
|||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityGeneratorLimitRemover.class, new RenderGeneratorLimitRemover());
|
||||
public Tuple<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.state.EnumProperty;
|
|||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.RedstoneSide;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
|
@ -21,8 +20,6 @@ import net.minecraft.world.IBlockReader;
|
|||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
||||
|
||||
|
@ -96,9 +93,9 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
BlockPos blockpos1 = pos.up();
|
||||
BlockState blockstate1 = worldIn.getBlockState(blockpos1);
|
||||
if (!blockstate1.isNormalCube(worldIn, blockpos1)) {
|
||||
boolean flag = blockstate.func_224755_d(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER;
|
||||
boolean flag = blockstate.isSolidSide(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER;
|
||||
if (flag && this.canConnectTo(worldIn.getBlockState(blockpos.up()))) {
|
||||
if (blockstate.func_224756_o(worldIn, blockpos)) {
|
||||
if (blockstate.isCollisionShapeOpaque(worldIn, blockpos)) {
|
||||
return RedstoneSide.UP;
|
||||
}
|
||||
|
||||
|
@ -118,7 +115,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||
BlockPos blockpos = pos.down();
|
||||
BlockState blockstate = worldIn.getBlockState(blockpos);
|
||||
return blockstate.func_224755_d(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER;
|
||||
return blockstate.isSolidSide(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -183,7 +180,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
|
||||
@Override
|
||||
public void updateDiagonalNeighbors(BlockState state, IWorld worldIn, BlockPos pos, int flags) {
|
||||
try (BlockPos.PooledMutableBlockPos pool = BlockPos.PooledMutableBlockPos.retain()) {
|
||||
try (BlockPos.PooledMutable pool = BlockPos.PooledMutable.retain()) {
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
RedstoneSide redstoneside = state.get(RedstoneWireBlock.FACING_PROPERTY_MAP.get(direction));
|
||||
if (redstoneside != RedstoneSide.NONE && worldIn.getBlockState(pool.setPos(pos).move(direction)).getBlock() != this) {
|
||||
|
@ -217,10 +214,4 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeColors;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -62,7 +63,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements
|
|||
return (state, worldIn, pos, tintIndex) -> {
|
||||
int color = 0xF2FF00;
|
||||
if (state != null && worldIn != null && pos != null) {
|
||||
int foliage = BiomeColors.getFoliageColor(worldIn, pos);
|
||||
int foliage = BiomeColors.func_228361_b_(worldIn, pos);
|
||||
return Helper.blendColors(color, foliage, state.get(STAGE) / (float) HIGHEST_STAGE);
|
||||
} else {
|
||||
return color;
|
||||
|
@ -77,7 +78,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
|
||||
super.randomTick(state, worldIn, pos, random);
|
||||
if (!worldIn.isRemote) {
|
||||
int stage = state.get(STAGE);
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.state.DirectionProperty;
|
|||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.tileentity.IHopper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -22,8 +22,6 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -87,18 +85,18 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!player.isSneaking())
|
||||
return false;
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!player.isShiftKeyDown())
|
||||
return ActionResultType.FAIL;
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityGratedChute))
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
if (!worldIn.isRemote) {
|
||||
TileEntityGratedChute chute = (TileEntityGratedChute) tile;
|
||||
chute.isBlacklist = !chute.isBlacklist;
|
||||
chute.sendToClients();
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -128,17 +126,11 @@ public class BlockGratedChute extends BlockContainerImpl {
|
|||
ItemStack stack = handler.getStackInSlot(0);
|
||||
if (stack.isEmpty())
|
||||
return 0;
|
||||
return MathHelper.ceil((stack.getCount() / (float) stack.getMaxStackSize()) * 15);
|
||||
return MathHelper.ceil(stack.getCount() / (float) stack.getMaxStackSize() * 15);
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT_MIPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
builder.add(FACING);
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
package de.ellpeck.naturesaura.blocks;
|
||||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -17,10 +22,10 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
private static final VoxelShape SHAPE = VoxelShapes.create(0, 0, 0, 1, 12 / 16F, 1);
|
||||
|
@ -35,13 +40,12 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityNatureAltar.class, new RenderNatureAltar());
|
||||
public Tuple<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.NATURE_ALTAR, RenderNatureAltar::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.naturesaura.blocks;
|
||||
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
|
@ -8,7 +9,11 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -18,8 +23,8 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
|
@ -30,7 +35,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||
}
|
||||
|
||||
|
@ -40,8 +45,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityOfferingTable.class, new RenderOfferingTable());
|
||||
public Tuple<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.OFFERING_TABLE, RenderOfferingTable::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
|
||||
@SubscribeEvent
|
||||
public void onPickup(EntityItemPickupEvent event) {
|
||||
PlayerEntity player = event.getEntityPlayer();
|
||||
if (player != null && !player.isSneaking()) {
|
||||
PlayerEntity player = event.getPlayer();
|
||||
if (player != null && !player.isShiftKeyDown()) {
|
||||
ItemEntity item = event.getItem();
|
||||
BlockPos pos = item.getPosition();
|
||||
Helper.getTileEntitiesInArea(item.world, pos, 8, tile -> {
|
||||
|
@ -47,7 +47,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
|
|||
|
||||
if (item.world.getGameTime() % 3 == 0)
|
||||
PacketHandler.sendToAllAround(item.world, pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.PICKUP_STOPPER));
|
||||
new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.PICKUP_STOPPER));
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks;
|
|||
|
||||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator;
|
||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||
|
@ -10,20 +11,22 @@ import de.ellpeck.naturesaura.reg.ITESRProvider;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider {
|
||||
public BlockProjectileGenerator() {
|
||||
super("projectile_generator", TileEntityProjectileGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
|
||||
|
@ -59,7 +62,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
IAuraChunk.getAuraChunk(entity.world, spot).storeAura(spot, amount);
|
||||
|
||||
PacketHandler.sendToAllAround(entity.world, pos, 32,
|
||||
new PacketParticles((float) entity.posX, (float) entity.posY, (float) entity.posZ, PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ()));
|
||||
new PacketParticles((float) entity.getPosX(), (float) entity.getPosY(), (float) entity.getPosZ(), PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ()));
|
||||
entity.world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_ENDER_EYE_LAUNCH, SoundCategory.BLOCKS, 0.8F, 1F);
|
||||
|
||||
generator.nextSide = generator.nextSide.rotateY();
|
||||
|
@ -70,8 +73,8 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
|
|||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityProjectileGenerator.class, new RenderProjectileGenerator());
|
||||
public Tuple<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import net.minecraft.block.SoundType;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.MobEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -74,12 +73,6 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
|
|||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockRenderLayer getRenderLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.Helper;
|
|||
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
|
||||
import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe;
|
||||
import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
|
@ -11,10 +12,13 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -25,8 +29,6 @@ import net.minecraft.util.math.shapes.VoxelShapes;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import net.minecraftforge.event.world.SaplingGrowTreeEvent;
|
||||
|
@ -36,6 +38,7 @@ import org.apache.commons.lang3.mutable.MutableObject;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider {
|
||||
|
||||
|
@ -100,13 +103,12 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
return Helper.putStackOnTile(player, handIn, pos, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<Class, TileEntityRenderer> getTESR() {
|
||||
return new Tuple<>(TileEntityWoodStand.class, new RenderWoodStand());
|
||||
public Tuple<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.WOOD_STAND, RenderWoodStand::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable
|
|||
for (ItemEntity item : items) {
|
||||
item.remove();
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.ANIMAL_SPAWNER));
|
||||
new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.ANIMAL_SPAWNER));
|
||||
}
|
||||
|
||||
this.currentRecipe = recipe;
|
||||
|
|
|
@ -104,13 +104,13 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickableTi
|
|||
|
||||
ItemStack remain = remainingItems.get(i);
|
||||
if (!remain.isEmpty()) {
|
||||
ItemEntity remItem = new ItemEntity(this.world, item.posX, item.posY, item.posZ, remain.copy());
|
||||
ItemEntity remItem = new ItemEntity(this.world, item.getPosX(), item.getPosY(), item.getPosZ(), remain.copy());
|
||||
remItem.setMotion(0, 0, 0);
|
||||
this.world.addEntity(remItem);
|
||||
}
|
||||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.ANIMAL_SPAWNER));
|
||||
new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.ANIMAL_SPAWNER));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile
|
|||
item.remove();
|
||||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.END_FLOWER_CONSUME, this.container.getAuraColor()));
|
||||
new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.END_FLOWER_CONSUME, this.container.getAuraColor()));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
|||
if (stack.isEmpty() || stack.getItem() != Items.FIREWORK_ROCKET)
|
||||
continue;
|
||||
if (this.trackedEntity == null && this.releaseTimer <= 0) {
|
||||
FireworkRocketEntity entity = new FireworkRocketEntity(this.world, item.posX, item.posY, item.posZ, stack);
|
||||
FireworkRocketEntity entity = new FireworkRocketEntity(this.world, item.getPosX(), item.getPosY(), item.getPosZ(), stack);
|
||||
this.trackedEntity = entity;
|
||||
this.trackedItem = stack.copy();
|
||||
this.world.addEntity(entity);
|
||||
|
@ -109,7 +109,7 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick
|
|||
data.add(this.pos.getZ());
|
||||
data.addAll(usedColors);
|
||||
PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles(
|
||||
(float) this.trackedEntity.posX, (float) this.trackedEntity.posY, (float) this.trackedEntity.posZ,
|
||||
(float) this.trackedEntity.getPosX(), (float) this.trackedEntity.getPosY(), (float) this.trackedEntity.getPosZ(),
|
||||
PacketParticles.Type.FIREWORK_GEN, Ints.toArray(data)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable
|
|||
IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 500);
|
||||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.HOPPER_UPGRADE));
|
||||
new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.HOPPER_UPGRADE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
|
|||
|
||||
((ServerWorld) this.world).addLightningBolt(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true));
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
|
||||
(float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.OFFERING_TABLE,
|
||||
(float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.OFFERING_TABLE,
|
||||
this.pos.getX(), this.pos.getY(), this.pos.getZ()));
|
||||
|
||||
break;
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile
|
|||
this.world.addEntity(item);
|
||||
|
||||
PacketHandler.sendToAllAround(this.world, this.pos, 32,
|
||||
new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.TR_SPAWN_RESULT));
|
||||
new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.TR_SPAWN_RESULT));
|
||||
this.world.playSound(null, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5,
|
||||
SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 0.65F, 1F);
|
||||
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -25,7 +22,17 @@ public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
|
|||
private static final FloatBuffer PROJECTION = GLAllocation.createDirectFloatBuffer(16);
|
||||
private final FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
|
||||
public RenderEnderCrate(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
super(rendererDispatcherIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityEnderCrate tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*@Override
|
||||
public void render(TileEntityEnderCrate tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
GlStateManager.disableLighting();
|
||||
RANDOM.setSeed(31100L);
|
||||
|
@ -107,7 +114,7 @@ public class RenderEnderCrate extends TileEntityRenderer<TileEntityEnderCrate> {
|
|||
if (flag) {
|
||||
gamerenderer.setupFogColor(false);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
protected int getPasses(double dist) {
|
||||
int i;
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -17,8 +13,19 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGeneratorLimitRemover> {
|
||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/generator_limit_remover_glint.png");
|
||||
private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint();
|
||||
//private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint();
|
||||
|
||||
public RenderGeneratorLimitRemover(TileEntityRendererDispatcher disp) {
|
||||
super(disp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityGeneratorLimitRemover tileEntityGeneratorLimitRemover, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*
|
||||
@Override
|
||||
public void render(TileEntityGeneratorLimitRemover te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
TileEntity above = te.getWorld().getTileEntity(te.getPos().up());
|
||||
|
@ -29,42 +36,44 @@ public class RenderGeneratorLimitRemover extends TileEntityRenderer<TileEntityGe
|
|||
}
|
||||
|
||||
private void renderGlint(double x, double y, double z) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderSystem.enableAlphaTest();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.alphaFunc(516, 0.003921569F);
|
||||
RenderSystem.alphaFunc(516, 0.003921569F);
|
||||
GlStateManager.depthMask(false);
|
||||
int brightness = 15 << 20 | 15 << 4;
|
||||
int j = brightness % 65536;
|
||||
int k = brightness / 65536;
|
||||
GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, (float) j, (float) k);
|
||||
float alpha = ((float) Math.sin(System.currentTimeMillis() / 800D) + 1F) / 2F;
|
||||
GlStateManager.color4f(alpha, alpha, alpha, alpha);
|
||||
GlStateManager.translated(x - 0.001F, y + 1 + 0.001F, z + 1 + 0.001F);
|
||||
GlStateManager.rotatef(180F, 1, 0, 0);
|
||||
GlStateManager.scalef(1.002F, 1.002F, 1.002F);
|
||||
RenderSystem.color4f(alpha, alpha, alpha, alpha);
|
||||
RenderSystem.translated(x - 0.001F, y + 1 + 0.001F, z + 1 + 0.001F);
|
||||
RenderSystem.rotatef(180F, 1, 0, 0);
|
||||
RenderSystem.scalef(1.002F, 1.002F, 1.002F);
|
||||
this.bindTexture(RES);
|
||||
this.model.render();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.alphaFunc(516, 0.1F);
|
||||
GlStateManager.disableAlphaTest();
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
RenderSystem.disableAlphaTest();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
private static class ModelLimitRemoverGlint extends Model {
|
||||
|
||||
private final RendererModel box;
|
||||
private final ModelRenderer box;
|
||||
|
||||
public ModelLimitRemoverGlint() {
|
||||
this.box = new RendererModel(this, 0, 0);
|
||||
super();
|
||||
this.box = new ModelRenderer(this, 0, 0);
|
||||
this.box.setTextureSize(64, 64);
|
||||
this.box.addBox(0, 0, 0, 16, 16, 16);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
this.box.render(1 / 16F);
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, IVertexBuilder iVertexBuilder, int i, int i1, float v, float v1, float v2, float v3) {
|
||||
this.box.render(matrixStack, iVertexBuilder, i, i1, v, v1, v2, v3);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
||||
public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar> {
|
||||
public RenderNatureAltar(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
super(rendererDispatcherIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityNatureAltar tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*@Override
|
||||
public void render(TileEntityNatureAltar tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
ItemStack stack = tileEntityIn.items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
|
@ -23,5 +31,5 @@ public class RenderNatureAltar extends TileEntityRenderer<TileEntityNatureAltar>
|
|||
Helper.renderItemInWorld(stack);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -16,9 +12,19 @@ public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTa
|
|||
|
||||
private final Random rand = new Random();
|
||||
|
||||
public RenderOfferingTable(TileEntityRendererDispatcher disp) {
|
||||
super(disp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityOfferingTable tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
ItemStack stack = tile.items.getStackInSlot(0);
|
||||
public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*@Override
|
||||
public void render(TileEntityOfferingTable tileEntityOfferingTable, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int j, int i1) {
|
||||
ItemStack stack = tileEntityOfferingTable.items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
this.rand.setSeed(Item.getIdFromItem(stack.getItem()) + stack.getDamage());
|
||||
|
||||
|
@ -29,7 +35,7 @@ public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTa
|
|||
|
||||
float scale;
|
||||
float yOff;
|
||||
if (item instanceof BlockItem && ((BlockItem) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) {
|
||||
if (item instanceof BlockItem) {
|
||||
scale = 0.4F;
|
||||
yOff = 0.08F;
|
||||
} else {
|
||||
|
@ -37,17 +43,17 @@ public class RenderOfferingTable extends TileEntityRenderer<TileEntityOfferingTa
|
|||
yOff = 0F;
|
||||
}
|
||||
|
||||
GlStateManager.translated(
|
||||
x + 0.35F + this.rand.nextFloat() * 0.3F,
|
||||
y + 0.9F + yOff + (i * 0.001F),
|
||||
z + 0.35F + this.rand.nextFloat() * 0.3F);
|
||||
GlStateManager.rotatef(this.rand.nextFloat() * 360F, 0F, 1F, 0F);
|
||||
GlStateManager.rotatef(90F, 1F, 0F, 0F);
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
matrixStack.translate(
|
||||
0.35F + this.rand.nextFloat() * 0.3F,
|
||||
0.9F + yOff + i * 0.001F,
|
||||
0.35F + this.rand.nextFloat() * 0.3F);
|
||||
matrixStack.rotate(this.rand.nextFloat() * 360F, 0F, 1F, 0F);
|
||||
matrixStack.rotate(90F, 1F, 0F, 0F);
|
||||
matrixStack.scale(scale, scale, scale);
|
||||
|
||||
Helper.renderItemInWorld(stack);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -16,9 +13,19 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderProjectileGenerator extends TileEntityRenderer<TileEntityProjectileGenerator> {
|
||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png");
|
||||
private final ModelOverlay model = new ModelOverlay();
|
||||
//private final ModelOverlay model = new ModelOverlay();
|
||||
|
||||
public RenderProjectileGenerator(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
super(rendererDispatcherIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityProjectileGenerator tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*@Override
|
||||
public void render(TileEntityProjectileGenerator te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableAlphaTest();
|
||||
|
@ -64,5 +71,5 @@ public class RenderProjectileGenerator extends TileEntityRenderer<TileEntityProj
|
|||
public void render() {
|
||||
this.box.render(1 / 16F);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,17 +1,24 @@
|
|||
package de.ellpeck.naturesaura.blocks.tiles.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
|
||||
public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {
|
||||
|
||||
public RenderWoodStand(TileEntityRendererDispatcher disp) {
|
||||
super(disp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileEntityWoodStand tileEntityWoodStand, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) {
|
||||
|
||||
}
|
||||
|
||||
// TODO TESR
|
||||
/*@Override
|
||||
public void render(TileEntityWoodStand tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
ItemStack stack = tile.items.getStackInSlot(0);
|
||||
if (!stack.isEmpty()) {
|
||||
|
@ -30,5 +37,5 @@ public class RenderWoodStand extends TileEntityRenderer<TileEntityWoodStand> {
|
|||
Helper.renderItemInWorld(stack);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
|
||||
ChickenEntity chicken = new ChickenEntity(EntityType.CHICKEN, world);
|
||||
chicken.setGrowingAge(-24000);
|
||||
chicken.setPosition(item.posX, item.posY, item.posZ);
|
||||
chicken.setPosition(item.getPosX(), item.getPosY(), item.getPosZ());
|
||||
world.addEntity(chicken);
|
||||
|
||||
BlockPos closestSpot = IAuraChunk.getHighestSpot(world, item.getPosition(), 35, pos);
|
||||
|
@ -135,9 +135,9 @@ public class AnimalEffect implements IDrainSpotEffect {
|
|||
animal.setInLove(null);
|
||||
for (int j = 0; j < 7; j++)
|
||||
animal.world.addParticle(ParticleTypes.HEART,
|
||||
(animal.posX + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F)) - animal.getWidth(),
|
||||
animal.posY + 0.5D + (double) (animal.world.rand.nextFloat() * animal.getHeight()),
|
||||
(animal.posZ + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F)) - animal.getWidth(),
|
||||
animal.getPosX() + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F) - animal.getWidth(),
|
||||
animal.getPosY() + 0.5D + (double) (animal.world.rand.nextFloat() * animal.getHeight()),
|
||||
animal.getPosZ() + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F) - animal.getWidth(),
|
||||
animal.world.rand.nextGaussian() * 0.02D,
|
||||
animal.world.rand.nextGaussian() * 0.02D,
|
||||
animal.world.rand.nextGaussian() * 0.02D);
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.gen.Heightmap;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class PlantBoostEffect implements IDrainSpotEffect {
|
||||
|
||||
|
@ -72,7 +73,7 @@ public class PlantBoostEffect implements IDrainSpotEffect {
|
|||
if (block instanceof IGrowable && !(block instanceof DoublePlantBlock) && !(block instanceof TallGrassBlock) && block != Blocks.GRASS) {
|
||||
IGrowable growable = (IGrowable) block;
|
||||
if (growable.canGrow(world, plantPos, state, false)) {
|
||||
growable.grow(world, world.rand, plantPos, state);
|
||||
growable.grow((ServerWorld) world, world.rand, plantPos, state);
|
||||
|
||||
BlockPos closestSpot = IAuraChunk.getHighestSpot(world, plantPos, 25, pos);
|
||||
IAuraChunk.getAuraChunk(world, closestSpot).drainAura(closestSpot, 3500);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package de.ellpeck.naturesaura.compat.jei;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe;
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
|
@ -13,7 +11,6 @@ import mezz.jei.api.helpers.IGuiHelper;
|
|||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
|
@ -82,9 +79,9 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
public void draw(AnimalSpawnerRecipe recipe, double mouseX, double mouseY) {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
Entity entity = this.entityCache.get(recipe.entity);
|
||||
if(entity == null){
|
||||
entity = recipe.makeEntity(minecraft.world,0,0,0);
|
||||
this.entityCache.put(recipe.entity,entity);
|
||||
if (entity == null) {
|
||||
entity = recipe.makeEntity(minecraft.world, 0, 0, 0);
|
||||
this.entityCache.put(recipe.entity, entity);
|
||||
}
|
||||
|
||||
float size = Math.max(1F, Math.max(recipe.entity.getWidth(), recipe.entity.getHeight()));
|
||||
|
@ -96,7 +93,8 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
}
|
||||
|
||||
private static void renderEntity(Entity entity, float x, float y, float rotation, float renderScale, float offset) {
|
||||
GlStateManager.enableColorMaterial();
|
||||
// TODO Render entity
|
||||
/*GlStateManager.enableColorMaterial();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
GlStateManager.translatef(x, y, 50.0F);
|
||||
|
@ -112,6 +110,6 @@ public class AnimalSpawnerCategory implements IRecipeCategory<AnimalSpawnerRecip
|
|||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE1);
|
||||
GlStateManager.disableTexture();
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE0);
|
||||
GlStateManager.activeTexture(GLX.GL_TEXTURE0);*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.naturesaura.compat.patchouli;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.naturesaura.ModConfig;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.api.multiblock.Matcher;
|
||||
|
@ -17,7 +18,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
import vazkii.patchouli.api.BookDrawScreenEvent;
|
||||
import vazkii.patchouli.api.PatchouliAPI;
|
||||
|
||||
|
@ -79,7 +80,7 @@ public class PatchouliCompat implements ICompat {
|
|||
int y = event.gui.height / 2 + 180 / 2;
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.color4f(1, 1, 1, 1);
|
||||
RenderSystem.color4f(1, 1, 1, 1);
|
||||
event.gui.getMinecraft().getTextureManager().bindTexture(ClientEvents.BOOK_GUI);
|
||||
|
||||
AbstractGui.blit(x, y, 496, 44, 16, 18, 512, 256);
|
||||
|
@ -89,7 +90,7 @@ public class PatchouliCompat implements ICompat {
|
|||
float r = ((info.color >> 16) & 255) / 255F;
|
||||
float g = ((info.color >> 8) & 255) / 255F;
|
||||
float b = (info.color & 255) / 255F;
|
||||
GlStateManager.color3f(r, g, b);
|
||||
RenderSystem.color3f(r, g, b);
|
||||
AbstractGui.blit(x, y, 496 - 32, 44, 16, 18, 512, 256);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
|
||||
@Override
|
||||
public void setPosition(double x, double y, double z) {
|
||||
boolean should = x != this.posX || y != this.posY || z != this.posZ;
|
||||
boolean should = x != this.getPosX() || y != this.getPosY() || z != this.getPosZ();
|
||||
if (should)
|
||||
this.removeFromPowderList();
|
||||
super.setPosition(x, y, z);
|
||||
|
@ -112,9 +112,9 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
|
|||
if (this.world.isRemote) {
|
||||
if (this.world.getGameTime() % 5 == 0) {
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
this.posX + this.world.rand.nextGaussian() * 0.1F,
|
||||
this.posY,
|
||||
this.posZ + this.world.rand.nextGaussian() * 0.1F,
|
||||
this.getPosX() + this.world.rand.nextGaussian() * 0.1F,
|
||||
this.getPosY(),
|
||||
this.getPosZ() + this.world.rand.nextGaussian() * 0.1F,
|
||||
this.world.rand.nextGaussian() * 0.005F,
|
||||
this.world.rand.nextFloat() * 0.03F,
|
||||
this.world.rand.nextGaussian() * 0.005F,
|
||||
|
|
|
@ -53,7 +53,7 @@ public class EntityMoverMinecart extends AbstractMinecartEntity {
|
|||
|
||||
if (!this.spotOffsets.isEmpty() && this.world.getGameTime() % 10 == 0)
|
||||
PacketHandler.sendToAllAround(this.world, pos, 32, new PacketParticles(
|
||||
(float) this.posX, (float) this.posY, (float) this.posZ, PacketParticles.Type.MOVER_CART,
|
||||
(float) this.getPosX(), (float) this.getPosY(), (float) this.getPosZ(), PacketParticles.Type.MOVER_CART,
|
||||
MathHelper.floor(this.getMotion().getX() * 100F), MathHelper.floor(this.getMotion().getY() * 100F), MathHelper.floor(this.getMotion().getZ() * 100F)));
|
||||
|
||||
if (pos.distanceSq(this.lastPosition) < 8 * 8)
|
||||
|
@ -115,7 +115,7 @@ public class EntityMoverMinecart extends AbstractMinecartEntity {
|
|||
|
||||
ListNBT list = new ListNBT();
|
||||
for (BlockPos offset : this.spotOffsets)
|
||||
list.add(new LongNBT(offset.toLong()));
|
||||
list.add(LongNBT.valueOf(offset.toLong()));
|
||||
compound.put("offsets", list);
|
||||
return compound;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
package de.ellpeck.naturesaura.entities.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
|
||||
import de.ellpeck.naturesaura.items.ItemEffectPowder;
|
||||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -26,7 +20,13 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
|
|||
super(renderManager);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ResourceLocation getEntityTexture(EntityEffectInhibitor entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO Render entities
|
||||
/* @Nullable
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityEffectInhibitor entity) {
|
||||
return AtlasTexture.LOCATION_BLOCKS_TEXTURE;
|
||||
|
@ -44,5 +44,5 @@ public class RenderEffectInhibitor extends EntityRenderer<EntityEffectInhibitor>
|
|||
Helper.renderItemInWorld(this.items.computeIfAbsent(effect,
|
||||
res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect)));
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,25 +1,29 @@
|
|||
package de.ellpeck.naturesaura.entities.render;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.entity.MinecartRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.RendererModel;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
||||
|
||||
private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/mover_cart.png");
|
||||
private final ModelMoverMinecart model = new ModelMoverMinecart();
|
||||
//private final ModelMoverMinecart model = new ModelMoverMinecart();
|
||||
|
||||
public RenderMoverMinecart(EntityRendererManager renderManagerIn) {
|
||||
super(renderManagerIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(EntityMoverMinecart entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
|
||||
super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
|
||||
}
|
||||
|
||||
// TODO Entity rendering
|
||||
/*@Override
|
||||
protected void renderCartContents(EntityMoverMinecart cart, float partialTicks, BlockState state) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(0, 22 / 16F, 0);
|
||||
|
@ -42,5 +46,5 @@ public class RenderMoverMinecart extends MinecartRenderer<EntityMoverMinecart> {
|
|||
public void render() {
|
||||
this.box.render(1 / 16F);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.naturesaura.events;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.naturesaura.Helper;
|
||||
import de.ellpeck.naturesaura.ModConfig;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
|
@ -124,7 +125,7 @@ public class ClientEvents {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onRenderLast(RenderWorldLastEvent event) {
|
||||
ParticleHandler.renderParticles(event.getPartialTicks());
|
||||
ParticleHandler.renderParticles(event.getMatrixStack(), event.getPartialTicks());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -151,8 +152,8 @@ public class ClientEvents {
|
|||
if (mc.world.getGameTime() % 20 == 0) {
|
||||
int amount = MathHelper.floor(190 * ModConfig.instance.excessParticleAmount.get());
|
||||
for (int i = 0; i < amount; i++) {
|
||||
int x = MathHelper.floor(mc.player.posX) + mc.world.rand.nextInt(64) - 32;
|
||||
int z = MathHelper.floor(mc.player.posZ) + mc.world.rand.nextInt(64) - 32;
|
||||
int x = MathHelper.floor(mc.player.getPosX()) + mc.world.rand.nextInt(64) - 32;
|
||||
int z = MathHelper.floor(mc.player.getPosZ()) + mc.world.rand.nextInt(64) - 32;
|
||||
BlockPos pos = new BlockPos(x, mc.world.getHeight(Heightmap.Type.WORLD_SURFACE, x, z) - 1, z);
|
||||
BlockState state = mc.world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
@ -168,7 +169,7 @@ public class ClientEvents {
|
|||
mc.world.rand.nextGaussian() * 0.01F,
|
||||
mc.world.rand.nextFloat() * 0.025F,
|
||||
mc.world.rand.nextGaussian() * 0.01F,
|
||||
BiomeColors.getFoliageColor(mc.world, pos),
|
||||
BiomeColors.func_228361_b_(mc.world, pos),
|
||||
Math.min(2F, 1F + mc.world.rand.nextFloat() * (excess / 30000F)),
|
||||
Math.min(300, 100 + mc.world.rand.nextInt(excess / 3000 + 1)),
|
||||
0F, false, true);
|
||||
|
@ -214,9 +215,9 @@ public class ClientEvents {
|
|||
GL11.glPushMatrix();
|
||||
float partial = event.getPartialTicks();
|
||||
GL11.glTranslated(
|
||||
-mc.player.prevPosX - (mc.player.posX - mc.player.prevPosX) * partial,
|
||||
-mc.player.prevPosY - (mc.player.posY - mc.player.prevPosY) * partial - (double) MathHelper.lerp(partial, this.previousHeight, this.height),
|
||||
-mc.player.prevPosZ - (mc.player.posZ - mc.player.prevPosZ) * partial);
|
||||
-mc.player.prevPosX - (mc.player.getPosX() - mc.player.prevPosX) * partial,
|
||||
-mc.player.prevPosY - (mc.player.getPosY() - mc.player.prevPosY) * partial - (double) MathHelper.lerp(partial, this.previousHeight, this.height),
|
||||
-mc.player.prevPosZ - (mc.player.getPosZ() - mc.player.prevPosZ) * partial);
|
||||
|
||||
if (mc.gameSettings.showDebugInfo && mc.player.isCreative() && ModConfig.instance.debugWorld.get()) {
|
||||
Map<BlockPos, Integer> spots = new HashMap<>();
|
||||
|
@ -229,7 +230,7 @@ public class ClientEvents {
|
|||
IAuraChunk.getSpotsInArea(mc.world, mc.player.getPosition(), 64, (pos, spot) -> {
|
||||
spots.put(pos, spot);
|
||||
|
||||
GlStateManager.color4f(spot > 0 ? 0F : 1F, spot > 0 ? 1F : 0F, 0F, 0.35F);
|
||||
RenderSystem.color4f(spot > 0 ? 0F : 1F, spot > 0 ? 1F : 0F, 0F, 0.35F);
|
||||
Helper.renderWeirdBox(pos.getX(), pos.getY(), pos.getZ(), 1, 1, 1);
|
||||
});
|
||||
GL11.glEnd();
|
||||
|
@ -237,15 +238,15 @@ public class ClientEvents {
|
|||
|
||||
float scale = 0.03F;
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
for (Map.Entry<BlockPos, Integer> spot : spots.entrySet()) {
|
||||
BlockPos pos = spot.getKey();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translated((pos.getX() + 0.1) / scale, (pos.getY() + 1) / scale, (pos.getZ() + 0.1) / scale);
|
||||
GlStateManager.rotatef(90F, 1F, 0F, 0F);
|
||||
GlStateManager.scalef(0.65F, 0.65F, 0.65F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translated((pos.getX() + 0.1) / scale, (pos.getY() + 1) / scale, (pos.getZ() + 0.1) / scale);
|
||||
RenderSystem.rotatef(90F, 1F, 0F, 0F);
|
||||
RenderSystem.scalef(0.65F, 0.65F, 0.65F);
|
||||
mc.fontRenderer.drawString(format.format(spot.getValue()), 0, 0, 0);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
|
@ -290,7 +291,7 @@ public class ClientEvents {
|
|||
return;
|
||||
box = box.grow(0.05F);
|
||||
int color = visualize.getVisualizationColor(world, pos);
|
||||
GlStateManager.color4f(((color >> 16) & 255) / 255F, ((color >> 8) & 255) / 255F, (color & 255) / 255F, 0.5F);
|
||||
RenderSystem.color4f(((color >> 16) & 255) / 255F, ((color >> 8) & 255) / 255F, (color & 255) / 255F, 0.5F);
|
||||
Helper.renderWeirdBox(box.minX, box.minY, box.minZ, box.maxX - box.minX, box.maxY - box.minY, box.maxZ - box.minZ);
|
||||
}
|
||||
|
||||
|
@ -306,10 +307,10 @@ public class ClientEvents {
|
|||
int x = res.getScaledWidth() / 2 - 173 - (mc.player.getHeldItemOffhand().isEmpty() ? 0 : 29);
|
||||
int y = res.getScaledHeight() - 8;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
|
||||
int color = container.getAuraColor();
|
||||
GlStateManager.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F);
|
||||
RenderSystem.color4f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1);
|
||||
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||
if (width < 80)
|
||||
AbstractGui.blit(x + width, y, width, 0, 80 - width, 6, 256, 256);
|
||||
|
@ -317,21 +318,21 @@ public class ClientEvents {
|
|||
AbstractGui.blit(x, y, 0, 6, width, 6, 256, 256);
|
||||
|
||||
float scale = 0.75F;
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
String s = heldCache.getDisplayName().getFormattedText();
|
||||
mc.fontRenderer.drawStringWithShadow(s, (x + 80) / scale - mc.fontRenderer.getStringWidth(s), (y - 7) / scale, color);
|
||||
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.color4f(1F, 1F, 1F, 1);
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
if (!heldEye.isEmpty() || !heldOcular.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
mc.getTextureManager().bindTexture(OVERLAYS);
|
||||
|
||||
int conf = ModConfig.instance.auraBarLocation.get();
|
||||
if (!mc.gameSettings.showDebugInfo && (conf != 2 || !(mc.currentScreen instanceof ChatScreen))) {
|
||||
GlStateManager.color3f(83 / 255F, 160 / 255F, 8 / 255F);
|
||||
RenderSystem.color4f(83 / 255F, 160 / 255F, 8 / 255F, 1);
|
||||
|
||||
int totalAmount = IAuraChunk.triangulateAuraInArea(mc.world, mc.player.getPosition(), 35);
|
||||
float totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F);
|
||||
|
@ -352,7 +353,7 @@ public class ClientEvents {
|
|||
AbstractGui.blit(startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256);
|
||||
|
||||
if (!heldOcular.isEmpty()) {
|
||||
GlStateManager.color3f(160 / 255F, 83 / 255F, 8 / 255F);
|
||||
RenderSystem.color4f(160 / 255F, 83 / 255F, 8 / 255F, 1);
|
||||
|
||||
int topHeight = MathHelper.ceil(MathHelper.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25);
|
||||
if (topHeight > 0) {
|
||||
|
@ -374,15 +375,15 @@ public class ClientEvents {
|
|||
if (totalPercentage < (heldOcular.isEmpty() ? 0F : -0.5F))
|
||||
mc.fontRenderer.drawStringWithShadow("-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scalef(textScale, textScale, textScale);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.scalef(textScale, textScale, textScale);
|
||||
mc.fontRenderer.drawStringWithShadow(text, textX / textScale, textY / textScale, 0x53a008);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
if (!heldOcular.isEmpty()) {
|
||||
float scale = 0.75F;
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scalef(scale, scale, scale);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
int stackX = conf % 2 == 0 ? 10 : res.getScaledWidth() - 22;
|
||||
int stackY = conf < 2 ? 15 : res.getScaledHeight() - 55;
|
||||
for (Tuple<ItemStack, Boolean> effect : SHOWING_EFFECTS.values()) {
|
||||
|
@ -398,7 +399,7 @@ public class ClientEvents {
|
|||
}
|
||||
stackY += 8;
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,17 +452,15 @@ public class ClientEvents {
|
|||
}
|
||||
}
|
||||
|
||||
GlStateManager.color3f(1F, 1F, 1F);
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.color4f(1F, 1F, 1F, 1);
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawContainerInfo(int stored, int max,
|
||||
int color, Minecraft mc, MainWindow res, int yOffset, String name, String
|
||||
textBelow) {
|
||||
GlStateManager.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F);
|
||||
private void drawContainerInfo(int stored, int max, int color, Minecraft mc, MainWindow res, int yOffset, String name, String textBelow) {
|
||||
RenderSystem.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F);
|
||||
|
||||
int x = res.getScaledWidth() / 2 - 40;
|
||||
int y = res.getScaledHeight() / 2 + yOffset;
|
||||
|
|
|
@ -47,7 +47,7 @@ public class CommonEvents {
|
|||
ChunkManager manager = ((ServerChunkProvider) event.world.getChunkProvider()).chunkManager;
|
||||
Iterable<ChunkHolder> chunks = (Iterable<ChunkHolder>) GET_LOADED_CHUNKS_METHOD.invoke(manager);
|
||||
for (ChunkHolder holder : chunks) {
|
||||
Chunk chunk = holder.func_219298_c();
|
||||
Chunk chunk = holder.getChunkIfComplete();
|
||||
if (chunk == null)
|
||||
continue;
|
||||
AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null).orElse(null);
|
||||
|
|
|
@ -115,7 +115,7 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem {
|
|||
BlockPos spot = IAuraChunk.getHighestSpot(player.world, pos, 30, pos);
|
||||
IAuraChunk.getAuraChunk(player.world, spot).drainAura(spot, 20000);
|
||||
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ,
|
||||
player.world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(),
|
||||
SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH, SoundCategory.PLAYERS, 1F, 1F);
|
||||
}
|
||||
player.swingArm(event.getHand());
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ItemBirthSpirit extends ItemGlowing {
|
|||
return;
|
||||
|
||||
int amount = parent.world.rand.nextInt(3) + 1;
|
||||
ItemEntity item = new ItemEntity(parent.world, parent.posX, parent.posY, parent.posZ,
|
||||
ItemEntity item = new ItemEntity(parent.world, parent.getPosX(), parent.getPosY(), parent.getPosZ(),
|
||||
new ItemStack(ModItems.BIRTH_SPIRIT, amount));
|
||||
parent.world.addEntity(item);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
|
|||
DyeColor color = (DyeColor) state.get(prop);
|
||||
if (firstColor == null || color == firstColor) {
|
||||
DyeColor stored = getStoredColor(stack);
|
||||
if (player.isSneaking()) {
|
||||
if (player.isShiftKeyDown()) {
|
||||
if (stored != color) {
|
||||
world.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
|
||||
SoundEvents.ITEM_BUCKET_FILL, SoundCategory.PLAYERS, 0.65F, 1F);
|
||||
|
@ -81,8 +81,8 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
|
|||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
||||
ItemStack stack = playerIn.getHeldItem(handIn);
|
||||
if (playerIn.isSneaking() && getStoredColor(stack) != null) {
|
||||
worldIn.playSound(playerIn, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F);
|
||||
if (playerIn.isShiftKeyDown() && getStoredColor(stack) != null) {
|
||||
worldIn.playSound(playerIn, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F);
|
||||
if (!worldIn.isRemote) {
|
||||
setFillMode(stack, !isFillMode(stack));
|
||||
}
|
||||
|
@ -92,7 +92,6 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static DyeColor getStoredColor(ItemStack stack) {
|
||||
if (!stack.hasTag()) {
|
||||
return null;
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ItemRangeVisualizer extends ItemImpl {
|
|||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
|
||||
ItemStack stack = playerIn.getHeldItem(handIn);
|
||||
if (playerIn.isSneaking()) {
|
||||
if (playerIn.isShiftKeyDown()) {
|
||||
clear();
|
||||
playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end_all"), true);
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
||||
|
|
|
@ -51,9 +51,9 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
|
|||
return;
|
||||
|
||||
compound.putBoolean("air", true);
|
||||
compound.putDouble("x", living.posX);
|
||||
compound.putDouble("y", living.posY);
|
||||
compound.putDouble("z", living.posZ);
|
||||
compound.putDouble("x", living.getPosX());
|
||||
compound.putDouble("y", living.getPosY());
|
||||
compound.putDouble("z", living.getPosZ());
|
||||
} else {
|
||||
if (!stack.hasTag())
|
||||
return;
|
||||
|
@ -63,7 +63,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
|
|||
|
||||
compound.putBoolean("air", false);
|
||||
|
||||
if (!living.isSneaking())
|
||||
if (!living.isShiftKeyDown())
|
||||
return;
|
||||
if (living.getDistanceSq(compound.getDouble("x"), compound.getDouble("y"), compound.getDouble("z")) > 0.75F)
|
||||
return;
|
||||
|
@ -79,8 +79,8 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
|
|||
|
||||
int range = 5;
|
||||
List<LivingEntity> mobs = worldIn.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(
|
||||
living.posX - range, living.posY - 0.5, living.posZ - range,
|
||||
living.posX + range, living.posY + 0.5, living.posZ + range));
|
||||
living.getPosX() - range, living.getPosY() - 0.5, living.getPosZ() - range,
|
||||
living.getPosX() + range, living.getPosY() + 0.5, living.getPosZ() + range));
|
||||
for (LivingEntity mob : mobs) {
|
||||
if (!mob.isAlive() || mob == living)
|
||||
continue;
|
||||
|
@ -103,7 +103,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem {
|
|||
worldIn.playSound(null, pos, type.getBreakSound(), SoundCategory.BLOCKS, type.getVolume() * 0.5F, type.getPitch() * 0.8F);
|
||||
}
|
||||
|
||||
PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, PacketParticles.Type.SHOCKWAVE_CREATOR));
|
||||
PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.getPosX(), (float) living.getPosY(), (float) living.getPosZ(), PacketParticles.Type.SHOCKWAVE_CREATOR));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ItemShovel extends ShovelItem implements IModItem, IModelProvider {
|
|||
damage = 5;
|
||||
}
|
||||
} else {
|
||||
int range = player.isSneaking() ? 0 : 1;
|
||||
int range = player.isShiftKeyDown() ? 0 : 1;
|
||||
for (int x = -range; x <= range; x++) {
|
||||
for (int y = -range; y <= range; y++) {
|
||||
BlockPos actualPos = pos.add(x, 0, y);
|
||||
|
|
|
@ -8,6 +8,7 @@ import de.ellpeck.naturesaura.blocks.Slab;
|
|||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import de.ellpeck.naturesaura.reg.IModItem;
|
||||
import de.ellpeck.naturesaura.reg.ModRegistry;
|
||||
import net.minecraft.advancements.criterion.StatePropertiesPredicate;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DirectoryCache;
|
||||
|
@ -46,7 +47,7 @@ public class BlockLootProvider implements IDataProvider {
|
|||
|
||||
this.lootFunctions.put(ModBlocks.ANCIENT_LEAVES, b -> LootTableHooks.genLeaves(b, ModBlocks.ANCIENT_SAPLING));
|
||||
this.lootFunctions.put(ModBlocks.DECAYED_LEAVES, LootTableHooks::genSilkOnly);
|
||||
this.lootFunctions.put(ModBlocks.GOLDEN_LEAVES, b -> LootTable.builder().addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(LootTableHooks.survivesExplosion(b, ItemLootEntry.builder(ModItems.GOLD_LEAF)).acceptCondition(BlockStateProperty.builder(b).with(BlockGoldenLeaves.STAGE, BlockGoldenLeaves.HIGHEST_STAGE))).acceptCondition(RandomChance.builder(0.75F))));
|
||||
this.lootFunctions.put(ModBlocks.GOLDEN_LEAVES, b -> LootTable.builder().addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(LootTableHooks.survivesExplosion(b, ItemLootEntry.builder(ModItems.GOLD_LEAF)).acceptCondition(BlockStateProperty.builder(b).fromProperties(StatePropertiesPredicate.Builder.newBuilder().withIntProp(BlockGoldenLeaves.STAGE, BlockGoldenLeaves.HIGHEST_STAGE)))).acceptCondition(RandomChance.builder(0.75F))));
|
||||
|
||||
}
|
||||
|
||||
|
@ -74,23 +75,23 @@ public class BlockLootProvider implements IDataProvider {
|
|||
// What a mess
|
||||
private static class LootTableHooks extends BlockLootTables {
|
||||
public static LootTable.Builder genLeaves(Block block, Block drop) {
|
||||
return func_218540_a(block, drop, 0.05F, 0.0625F, 0.083333336F, 0.1F);
|
||||
return droppingWithChancesAndSticks(block, drop, 0.05F, 0.0625F, 0.083333336F, 0.1F);
|
||||
}
|
||||
|
||||
public static LootTable.Builder genSlab(Block block) {
|
||||
return func_218513_d(block);
|
||||
return droppingSlab(block);
|
||||
}
|
||||
|
||||
public static LootTable.Builder genRegular(Block block) {
|
||||
return func_218546_a(block);
|
||||
return dropping(block);
|
||||
}
|
||||
|
||||
public static LootTable.Builder genSilkOnly(Block block) {
|
||||
return func_218561_b(block);
|
||||
return onlyWithSilkTouch(block);
|
||||
}
|
||||
|
||||
public static <T> T survivesExplosion(Block block, ILootConditionConsumer<T> then) {
|
||||
return func_218560_a(block, then);
|
||||
return withSurvivesExplosion(block, then);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,7 +23,10 @@ import net.minecraftforge.common.util.LazyOptional;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WorldData implements IWorldData {
|
||||
private final Map<String, ItemStackHandlerNA> enderStorages = new HashMap<>();
|
||||
|
@ -53,7 +56,7 @@ public class WorldData implements IWorldData {
|
|||
|
||||
ListNBT moss = new ListNBT();
|
||||
for (BlockPos pos : this.recentlyConvertedMossStones)
|
||||
moss.add(new LongNBT(pos.toLong()));
|
||||
moss.add(LongNBT.valueOf(pos.toLong()));
|
||||
compound.put("converted_moss", moss);
|
||||
|
||||
return compound;
|
||||
|
|
|
@ -217,7 +217,7 @@ public class PacketParticles {
|
|||
message.posX + 0.5F,
|
||||
message.posY + 0.5F,
|
||||
message.posZ + 0.5F,
|
||||
0.6F, BiomeColors.getFoliageColor(world, new BlockPos(sapX, sapY, sapZ)), 1.5F);
|
||||
0.6F, BiomeColors.func_228361_b_(world, new BlockPos(sapX, sapY, sapZ)), 1.5F);
|
||||
if (releaseAura)
|
||||
for (int i = world.rand.nextInt(10) + 10; i >= 0; i--)
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package de.ellpeck.naturesaura.particles;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.naturesaura.ModConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||
|
@ -65,7 +67,7 @@ public final class ParticleHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public static void renderParticles(float partialTicks) {
|
||||
public static void renderParticles(MatrixStack stack, float partialTicks) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ClientPlayerEntity player = mc.player;
|
||||
|
||||
|
@ -76,17 +78,15 @@ public final class ParticleHandler {
|
|||
float f2 = -f1 * MathHelper.sin(info.getPitch() * ((float) Math.PI / 180F));
|
||||
float f3 = f * MathHelper.sin(info.getPitch() * ((float) Math.PI / 180F));
|
||||
float f4 = MathHelper.cos(info.getPitch() * ((float) Math.PI / 180F));
|
||||
Particle.interpPosX = info.getProjectedView().x;
|
||||
Particle.interpPosY = info.getProjectedView().y;
|
||||
Particle.interpPosZ = info.getProjectedView().z;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.multMatrix(stack.getLast().getPositionMatrix());
|
||||
|
||||
GlStateManager.enableAlphaTest();
|
||||
RenderSystem.enableAlphaTest();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.alphaFunc(516, 0.003921569F);
|
||||
RenderSystem.alphaFunc(516, 0.003921569F);
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE.param);
|
||||
|
||||
GlStateManager.depthMask(false);
|
||||
|
||||
|
@ -94,25 +94,25 @@ public final class ParticleHandler {
|
|||
Tessellator tessy = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessy.getBuffer();
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
|
||||
for (Particle particle : PARTICLES)
|
||||
particle.renderParticle(buffer, info, partialTicks, f, f4, f1, f2, f3);
|
||||
particle.renderParticle(buffer, info, partialTicks);
|
||||
tessy.draw();
|
||||
|
||||
GlStateManager.disableDepthTest();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX);
|
||||
for (Particle particle : PARTICLES_NO_DEPTH)
|
||||
particle.renderParticle(buffer, info, partialTicks, f, f4, f1, f2, f3);
|
||||
particle.renderParticle(buffer, info, partialTicks);
|
||||
tessy.draw();
|
||||
GlStateManager.enableDepthTest();
|
||||
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.alphaFunc(516, 0.1F);
|
||||
RenderSystem.alphaFunc(516, 0.1F);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package de.ellpeck.naturesaura.particles;
|
||||
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import de.ellpeck.naturesaura.NaturesAura;
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.Quaternion;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -31,9 +35,9 @@ public class ParticleMagic extends Particle {
|
|||
this.motionY = motionY;
|
||||
this.motionZ = motionZ;
|
||||
|
||||
float r = (((color >> 16) & 255) / 255F) * (1F - this.rand.nextFloat() * 0.25F);
|
||||
float g = (((color >> 8) & 255) / 255F) * (1F - this.rand.nextFloat() * 0.25F);
|
||||
float b = ((color & 255) / 255F) * (1F - this.rand.nextFloat() * 0.25F);
|
||||
float r = (color >> 16 & 255) / 255F * (1F - this.rand.nextFloat() * 0.25F);
|
||||
float g = (color >> 8 & 255) / 255F * (1F - this.rand.nextFloat() * 0.25F);
|
||||
float b = (color & 255) / 255F * (1F - this.rand.nextFloat() * 0.25F);
|
||||
this.setColor(r, g, b);
|
||||
|
||||
this.particleAlpha = 1F;
|
||||
|
@ -64,28 +68,29 @@ public class ParticleMagic extends Particle {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(BufferBuilder buffer, ActiveRenderInfo entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
|
||||
double x = this.prevPosX + (this.posX - this.prevPosX) * partialTicks - interpPosX;
|
||||
double y = this.prevPosY + (this.posY - this.prevPosY) * partialTicks - interpPosY;
|
||||
double z = this.prevPosZ + (this.posZ - this.prevPosZ) * partialTicks - interpPosZ;
|
||||
float sc = 0.1F * this.particleScale;
|
||||
public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) {
|
||||
Vec3d vec3d = renderInfo.getProjectedView();
|
||||
float f = (float) (MathHelper.lerp(partialTicks, this.prevPosX, this.posX) - vec3d.getX());
|
||||
float f1 = (float) (MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY());
|
||||
float f2 = (float) (MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ());
|
||||
Quaternion quaternion = renderInfo.getRotation();
|
||||
Vector3f vector3f1 = new Vector3f(-1.0F, -1.0F, 0.0F);
|
||||
vector3f1.transform(quaternion);
|
||||
Vector3f[] avector3f = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)};
|
||||
float f4 = 0.1F * this.particleScale;
|
||||
|
||||
int brightness = this.getBrightnessForRender(partialTicks);
|
||||
int sky = brightness >> 16 & 0xFFFF;
|
||||
int block = brightness & 0xFFFF;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
Vector3f vector3f = avector3f[i];
|
||||
vector3f.transform(quaternion);
|
||||
vector3f.mul(f4);
|
||||
vector3f.add(f, f1, f2);
|
||||
}
|
||||
|
||||
buffer.pos(x + (-rotationX * sc - rotationXY * sc), y + -rotationZ * sc, z + (-rotationYZ * sc - rotationXZ * sc))
|
||||
.tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha)
|
||||
.lightmap(sky, block).endVertex();
|
||||
buffer.pos(x + (-rotationX * sc + rotationXY * sc), y + (rotationZ * sc), z + (-rotationYZ * sc + rotationXZ * sc))
|
||||
.tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha)
|
||||
.lightmap(sky, block).endVertex();
|
||||
buffer.pos(x + (rotationX * sc + rotationXY * sc), y + (rotationZ * sc), z + (rotationYZ * sc + rotationXZ * sc))
|
||||
.tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha)
|
||||
.lightmap(sky, block).endVertex();
|
||||
buffer.pos(x + (rotationX * sc - rotationXY * sc), y + (-rotationZ * sc), z + (rotationYZ * sc - rotationXZ * sc))
|
||||
.tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha)
|
||||
.lightmap(sky, block).endVertex();
|
||||
int j = this.getBrightnessForRender(partialTicks);
|
||||
buffer.pos(avector3f[0].getX(), avector3f[0].getY(), avector3f[0].getZ()).tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex();
|
||||
buffer.pos(avector3f[1].getX(), avector3f[1].getY(), avector3f[1].getZ()).tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex();
|
||||
buffer.pos(avector3f[2].getX(), avector3f[2].getY(), avector3f[2].getZ()).tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex();
|
||||
buffer.pos(avector3f[3].getX(), avector3f[3].getY(), avector3f[3].getZ()).tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,8 +18,12 @@ import net.minecraft.client.renderer.color.IItemColor;
|
|||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.client.renderer.entity.PlayerRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
|
@ -28,6 +32,7 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
|||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ClientProxy implements IProxy {
|
||||
|
@ -74,8 +79,8 @@ public class ClientProxy implements IProxy {
|
|||
|
||||
@Override
|
||||
public void registerTESR(ITESRProvider provider) {
|
||||
Tuple<Class, TileEntityRenderer> tesr = provider.getTESR();
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(tesr.getA(), tesr.getB());
|
||||
Tuple<TileEntityType, Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntity>>> tesr = provider.getTESR();
|
||||
ClientRegistry.bindTileEntityRenderer(tesr.getA(), tesr.getB());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,7 +102,7 @@ public class ClientProxy implements IProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> void registerEntityRenderer(Class<T> entityClass, Supplier<IRenderFactory<T>> renderFactory) {
|
||||
public <T extends Entity> void registerEntityRenderer(EntityType<T> entityClass, Supplier<IRenderFactory<T>> renderFactory) {
|
||||
RenderingRegistry.registerEntityRenderingHandler(entityClass, renderFactory.get());
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.reg.IColorProvidingBlock;
|
|||
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
|
@ -28,6 +29,6 @@ public interface IProxy {
|
|||
|
||||
void setParticleSpawnRange(int range);
|
||||
|
||||
<T extends Entity> void registerEntityRenderer(Class<T> entityClass, Supplier<IRenderFactory<T>> renderFactory);
|
||||
<T extends Entity> void registerEntityRenderer(EntityType<T> entityClass, Supplier<IRenderFactory<T>> renderFactory);
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.reg.IColorProvidingBlock;
|
|||
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
|
||||
import de.ellpeck.naturesaura.reg.ITESRProvider;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
|
||||
|
@ -57,7 +58,7 @@ public class ServerProxy implements IProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> void registerEntityRenderer(Class<T> entityClass, Supplier<IRenderFactory<T>> renderFactory) {
|
||||
public <T extends Entity> void registerEntityRenderer(EntityType<T> entityClass, Supplier<IRenderFactory<T>> renderFactory) {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,13 +1,18 @@
|
|||
package de.ellpeck.naturesaura.reg;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public interface ITESRProvider {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
Tuple<Class, TileEntityRenderer> getTESR();
|
||||
Tuple<TileEntityType, Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntity>>> getTESR();
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.items.ModItems;
|
|||
import net.minecraft.inventory.EquipmentSlotType;
|
||||
import net.minecraft.item.IArmorMaterial;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyLoadBase;
|
||||
import net.minecraft.util.LazyValue;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -24,7 +24,7 @@ public enum ModArmorMaterial implements IArmorMaterial {
|
|||
private final int enchantability;
|
||||
private final SoundEvent soundEvent;
|
||||
private final float toughness;
|
||||
private final LazyLoadBase<Ingredient> repairMaterial;
|
||||
private final LazyValue<Ingredient> repairMaterial;
|
||||
|
||||
ModArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountsIn, int enchantabilityIn, SoundEvent equipSoundIn, float toughness, Supplier<Ingredient> repairMaterialSupplier) {
|
||||
this.name = nameIn;
|
||||
|
@ -33,7 +33,7 @@ public enum ModArmorMaterial implements IArmorMaterial {
|
|||
this.enchantability = enchantabilityIn;
|
||||
this.soundEvent = equipSoundIn;
|
||||
this.toughness = toughness;
|
||||
this.repairMaterial = new LazyLoadBase<>(repairMaterialSupplier);
|
||||
this.repairMaterial = new LazyValue<>(repairMaterialSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.reg;
|
|||
import de.ellpeck.naturesaura.items.ModItems;
|
||||
import net.minecraft.item.IItemTier;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.LazyLoadBase;
|
||||
import net.minecraft.util.LazyValue;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -15,7 +15,7 @@ public enum ModItemTier implements IItemTier {
|
|||
private final float efficiency;
|
||||
private final float attackDamage;
|
||||
private final int enchantability;
|
||||
private final LazyLoadBase<Ingredient> repairMaterial;
|
||||
private final LazyValue<Ingredient> repairMaterial;
|
||||
|
||||
ModItemTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier<Ingredient> repairMaterialIn) {
|
||||
this.harvestLevel = harvestLevelIn;
|
||||
|
@ -23,7 +23,7 @@ public enum ModItemTier implements IItemTier {
|
|||
this.efficiency = efficiencyIn;
|
||||
this.attackDamage = attackDamageIn;
|
||||
this.enchantability = enchantabilityIn;
|
||||
this.repairMaterial = new LazyLoadBase<>(repairMaterialIn);
|
||||
this.repairMaterial = new LazyValue<>(repairMaterialIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -233,8 +233,8 @@ public final class ModRegistry {
|
|||
);
|
||||
Helper.populateObjectHolders(ModEntities.class, event.getRegistry());
|
||||
|
||||
NaturesAura.proxy.registerEntityRenderer(EntityMoverMinecart.class, () -> RenderMoverMinecart::new);
|
||||
NaturesAura.proxy.registerEntityRenderer(EntityEffectInhibitor.class, () -> RenderEffectInhibitor::new);
|
||||
NaturesAura.proxy.registerEntityRenderer(ModEntities.MOVER_CART, () -> RenderMoverMinecart::new);
|
||||
NaturesAura.proxy.registerEntityRenderer(ModEntities.EFFECT_INHIBITOR, () -> RenderEffectInhibitor::new);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package de.ellpeck.naturesaura.renderers;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.ellpeck.naturesaura.api.render.ITrinketItem;
|
||||
import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType;
|
||||
import de.ellpeck.naturesaura.compat.Compat;
|
||||
import net.minecraft.client.entity.player.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.IEntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
import net.minecraft.client.renderer.entity.model.PlayerModel;
|
||||
|
@ -18,7 +21,6 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import top.theillusivec4.curios.api.CuriosAPI;
|
||||
import top.theillusivec4.curios.api.capability.ICurioItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -31,30 +33,30 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
|
|||
super(entityRendererIn);
|
||||
}
|
||||
|
||||
// TODO Test this
|
||||
@Override
|
||||
public void render(@Nonnull AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||
if (player.getActivePotionEffect(Effects.INVISIBILITY) != null)
|
||||
return;
|
||||
ItemStack main = player.getHeldItemMainhand();
|
||||
ItemStack second = player.getHeldItemOffhand();
|
||||
|
||||
this.alreadyRendered.clear();
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.pushLightingAttributes();
|
||||
GlStateManager.pushTextureAttributes();
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.pushLightingAttributes();
|
||||
RenderSystem.pushTextureAttributes();
|
||||
RenderSystem.color4f(1F, 1F, 1F, 1F);
|
||||
this.render(player, RenderType.BODY, main, second);
|
||||
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
|
||||
float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
|
||||
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;
|
||||
GlStateManager.rotatef(yawOffset, 0, -1, 0);
|
||||
GlStateManager.rotatef(yaw - 270, 0, 1, 0);
|
||||
GlStateManager.rotatef(pitch, 0, 0, 1);
|
||||
RenderSystem.rotatef(yawOffset, 0, -1, 0);
|
||||
RenderSystem.rotatef(yaw - 270, 0, 1, 0);
|
||||
RenderSystem.rotatef(pitch, 0, 0, 1);
|
||||
this.render(player, RenderType.HEAD, main, second);
|
||||
GlStateManager.popAttributes();
|
||||
GlStateManager.popAttributes();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
RenderSystem.popAttributes();
|
||||
RenderSystem.popAttributes();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
private void render(PlayerEntity player, RenderType type, ItemStack main, ItemStack second) {
|
||||
|
@ -79,7 +81,7 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
|
|||
Item item = stack.getItem();
|
||||
if (item instanceof ITrinketItem && !this.alreadyRendered.contains(item)) {
|
||||
GlStateManager.pushMatrix();
|
||||
if (type == RenderType.BODY && player.isSneaking()) {
|
||||
if (type == RenderType.BODY && player.isShiftKeyDown()) {
|
||||
GlStateManager.translatef(0F, 0.2F, 0F);
|
||||
GlStateManager.rotatef(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
@ -89,9 +91,4 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCombineTextures() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -54,15 +54,15 @@ public class SupporterFancyHandler {
|
|||
int color;
|
||||
if (info.tier == 1) {
|
||||
BlockPos pos = player.getPosition();
|
||||
color = BiomeColors.getFoliageColor(player.world, pos);
|
||||
color = BiomeColors.func_228361_b_(player.world, pos);
|
||||
} else {
|
||||
color = info.color;
|
||||
}
|
||||
|
||||
NaturesAuraAPI.instance().spawnMagicParticle(
|
||||
player.posX + rand.nextGaussian() * 0.15F,
|
||||
player.posY + rand.nextFloat() * 1.8F,
|
||||
player.posZ + rand.nextGaussian() * 0.15F,
|
||||
player.getPosX() + rand.nextGaussian() * 0.15F,
|
||||
player.getPosY() + rand.nextFloat() * 1.8F,
|
||||
player.getPosZ() + rand.nextGaussian() * 0.15F,
|
||||
rand.nextGaussian() * 0.01F,
|
||||
rand.nextFloat() * 0.01F,
|
||||
rand.nextGaussian() * 0.01F,
|
||||
|
|
Loading…
Reference in a new issue