diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java index cd96a5de..1f84e926 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java @@ -12,7 +12,6 @@ import net.minecraft.util.math.shapes.ISelectionContext; 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; @@ -67,7 +66,7 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte if (state.get(SaplingBlock.STAGE) == 0) { world.setBlockState(pos, state.cycle(SaplingBlock.STAGE), 4); } else if (ForgeEventFactory.saplingGrowTree(world, rand, pos)) { - new WorldGenAncientTree(true).place(world, world.getChunkProvider().getChunkGenerator(), rand, pos, IFeatureConfig.NO_FEATURE_CONFIG); + new WorldGenAncientTree().place(world, world.getChunkProvider().getChunkGenerator(), rand, pos, WorldGenAncientTree.CONFIG); } } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java index a3abbacb..4e51b60c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java @@ -46,8 +46,9 @@ import java.lang.ref.WeakReference; import java.util.List; import java.util.Random; import java.util.function.Function; +import java.util.function.Supplier; -public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider { +public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider { // This is terrible but I can't see a better solution right now so oh well private static final ThreadLocal> CACHED_WORLD = new ThreadLocal<>(); @@ -135,17 +136,17 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider int j = rand.nextInt(2) * 2 - 1; int k = rand.nextInt(2) * 2 - 1; double d0 = (double) pos.getX() + 0.5D + 0.25D * (double) j; - double d1 = (double) ((float) pos.getY() + rand.nextFloat()); + double d1 = (float) pos.getY() + rand.nextFloat(); double d2 = (double) pos.getZ() + 0.5D + 0.25D * (double) k; - double d3 = (double) (rand.nextFloat() * (float) j); + double d3 = rand.nextFloat() * (float) j; double d4 = ((double) rand.nextFloat() - 0.5D) * 0.125D; - double d5 = (double) (rand.nextFloat() * (float) k); + double d5 = rand.nextFloat() * (float) k; worldIn.addParticle(ParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5); } } @Override - public Tuple>> getTESR() { - return new Tuple<>(ModTileEntities.ENDER_CRATE, RenderEnderCrate::new); + public Tuple, Supplier>>> getTESR() { + return new Tuple<>(ModTileEntities.ENDER_CRATE, () -> RenderEnderCrate::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java index ee1db6e2..86c5f0d5 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java @@ -8,23 +8,20 @@ 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; +import java.util.function.Supplier; -public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider { +public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider { public BlockGeneratorLimitRemover() { super("generator_limit_remover", TileEntityGeneratorLimitRemover::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); } @Override - @OnlyIn(Dist.CLIENT) - public Tuple>> getTESR() { - return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new); + public Tuple, Supplier>>> getTESR() { + return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, () -> RenderGeneratorLimitRemover::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java index 1fb80c31..efbbd2db 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java @@ -10,7 +10,6 @@ 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; @@ -25,8 +24,9 @@ import net.minecraft.world.World; import net.minecraftforge.common.ToolType; import java.util.function.Function; +import java.util.function.Supplier; -public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider { +public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider { private static final VoxelShape SHAPE = VoxelShapes.create(0, 0, 0, 1, 12 / 16F, 1); @@ -45,7 +45,7 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide } @Override - public Tuple>> getTESR() { - return new Tuple<>(ModTileEntities.NATURE_ALTAR, RenderNatureAltar::new); + public Tuple, Supplier>>> getTESR() { + return new Tuple<>(ModTileEntities.NATURE_ALTAR, () -> RenderNatureAltar::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java index 04cd27cf..54e37dfd 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java @@ -11,7 +11,6 @@ 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; @@ -25,8 +24,9 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import java.util.function.Function; +import java.util.function.Supplier; -public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider { +public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider { private static final VoxelShape SHAPE = VoxelShapes.create(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F); @@ -45,7 +45,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi } @Override - public Tuple>> getTESR() { - return new Tuple<>(ModTileEntities.OFFERING_TABLE, RenderOfferingTable::new); + public Tuple, Supplier>>> getTESR() { + return new Tuple<>(ModTileEntities.OFFERING_TABLE, () -> RenderOfferingTable::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java index 68f71dee..1b48554e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java @@ -26,8 +26,9 @@ import net.minecraftforge.event.entity.ProjectileImpactEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import java.util.function.Function; +import java.util.function.Supplier; -public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider { +public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider { public BlockProjectileGenerator() { super("projectile_generator", TileEntityProjectileGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); @@ -73,8 +74,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES } @Override - public Tuple>> getTESR() { - return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new); + public Tuple, Supplier>>> getTESR() { + return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, () -> RenderProjectileGenerator::new); } - } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java index d4137ed3..1e9e375a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java @@ -39,8 +39,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Function; +import java.util.function.Supplier; -public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider { +public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider { private static final VoxelShape SHAPE = VoxelShapes.create(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F); @@ -108,7 +109,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider } @Override - public Tuple>> getTESR() { - return new Tuple<>(ModTileEntities.WOOD_STAND, RenderWoodStand::new); + public Tuple, Supplier>>> getTESR() { + return new Tuple<>(ModTileEntities.WOOD_STAND, () -> RenderWoodStand::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java index 07112657..f8490d20 100644 --- a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java +++ b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java @@ -11,19 +11,23 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.gen.IWorldGenerationReader; import net.minecraft.world.gen.feature.AbstractTreeFeature; -import net.minecraft.world.gen.feature.NoFeatureConfig; +import net.minecraft.world.gen.feature.TreeFeatureConfig; import java.util.Random; import java.util.Set; -public class WorldGenAncientTree extends AbstractTreeFeature { +// TODO figure out if this still works like it should +public class WorldGenAncientTree extends AbstractTreeFeature { - public WorldGenAncientTree(boolean notify) { - super(NoFeatureConfig::deserialize, notify); + // what the heck even is this + public static final TreeFeatureConfig CONFIG = new TreeFeatureConfig.Builder(null, null, null).build(); + + public WorldGenAncientTree() { + super(d -> CONFIG); } @Override - protected boolean place(Set changedBlocks, IWorldGenerationReader world, Random rand, BlockPos pos, MutableBoundingBox box) { + protected boolean func_225557_a_(IWorldGenerationReader world, Random rand, BlockPos pos, Set cb1, Set cb2, MutableBoundingBox box, TreeFeatureConfig config) { int height = rand.nextInt(3) + 5; BlockPos trunkTop = pos.up(height); @@ -41,7 +45,7 @@ public class WorldGenAncientTree extends AbstractTreeFeature { if (goal.distanceSq(pos) >= 10 * 10) break; } - this.makeBranch(changedBlocks, world, pos.up(rand.nextInt(1)), goal, ModBlocks.ANCIENT_BARK.getDefaultState(), false); + this.makeBranch(cb1, world, pos.up(rand.nextInt(1)), goal, ModBlocks.ANCIENT_BARK.getDefaultState(), false); } //Trunk @@ -51,12 +55,12 @@ public class WorldGenAncientTree extends AbstractTreeFeature { BlockPos goal = pos.add(x, i, z); if (func_214587_a(world, goal)) { this.setBlockState(world, goal, ModBlocks.ANCIENT_LOG.getDefaultState().with(LogBlock.AXIS, Axis.Y)); - changedBlocks.add(goal); + cb1.add(goal); } } } } - this.makeLeaves(changedBlocks, world, trunkTop.up(rand.nextInt(2) - 1), ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 3, rand); + this.makeLeaves(cb2, world, trunkTop.up(rand.nextInt(2) - 1), ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 3, rand); //Branches int branchAmount = rand.nextInt(3) + 4; @@ -67,8 +71,8 @@ public class WorldGenAncientTree extends AbstractTreeFeature { float z = (float) Math.cos(angle) * length; BlockPos goal = trunkTop.add(x, rand.nextInt(3) + 1, z); - this.makeBranch(changedBlocks, world, trunkTop, goal, ModBlocks.ANCIENT_LOG.getDefaultState(), true); - this.makeLeaves(changedBlocks, world, goal, ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 2, rand); + this.makeBranch(cb1, world, trunkTop, goal, ModBlocks.ANCIENT_LOG.getDefaultState(), true); + this.makeLeaves(cb2, world, goal, ModBlocks.ANCIENT_LEAVES.getDefaultState(), rand.nextInt(2) + 2, rand); } return true; @@ -82,7 +86,7 @@ public class WorldGenAncientTree extends AbstractTreeFeature { float stepZ = (float) pos.getZ() / (float) length; for (int i = 0; i <= length; i++) { - BlockPos goal = first.add((0.5F + i * stepX), (0.5F + i * stepY), (0.5F + i * stepZ)); + BlockPos goal = first.add(0.5F + i * stepX, 0.5F + i * stepY, 0.5F + i * stepZ); if (func_214587_a(world, goal)) { if (hasAxis) { Axis axis = this.getLogAxis(first, goal); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java index a54d80af..99865077 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java @@ -41,7 +41,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem { public void inventoryTick(ItemStack stackIn, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (!worldIn.isRemote && entityIn instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) entityIn; - if (player.isSneaking() && stackIn.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) { + if (player.isShiftKeyDown() && stackIn.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) { IAuraContainer container = stackIn.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null); if (container.getStoredAura() <= 0) { return; diff --git a/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java b/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java index 69086e06..b7f0ba05 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java @@ -68,6 +68,10 @@ public final class ParticleHandler { } public static void renderParticles(MatrixStack stack, float partialTicks) { + // TODO Render particles + if(true) + return; + Minecraft mc = Minecraft.getInstance(); ClientPlayerEntity player = mc.player; diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java index f03540e7..040bd86b 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java @@ -79,8 +79,8 @@ public class ClientProxy implements IProxy { @Override public void registerTESR(ITESRProvider provider) { - Tuple>> tesr = provider.getTESR(); - ClientRegistry.bindTileEntityRenderer(tesr.getA(), tesr.getB()); + Tuple, Supplier>>> tesr = provider.getTESR(); + ClientRegistry.bindTileEntityRenderer(tesr.getA(), tesr.getB().get()); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java index dcdde7f6..602fe4c7 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java @@ -9,10 +9,11 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import java.util.function.Function; +import java.util.function.Supplier; -public interface ITESRProvider { +public interface ITESRProvider { @OnlyIn(Dist.CLIENT) - Tuple>> getTESR(); + Tuple, Supplier>>> getTESR(); }