mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-05 04:49:10 +01:00
it launches, but it's completely fucked
This commit is contained in:
parent
8737bc28f6
commit
3d3e2d93ae
12 changed files with 53 additions and 46 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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<TileEntityEnderCrate> {
|
||||
|
||||
// This is terrible but I can't see a better solution right now so oh well
|
||||
private static final ThreadLocal<WeakReference<World>> 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<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.ENDER_CRATE, RenderEnderCrate::new);
|
||||
public Tuple<TileEntityType<TileEntityEnderCrate>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityEnderCrate>>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.ENDER_CRATE, () -> RenderEnderCrate::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TileEntityGeneratorLimitRemover> {
|
||||
|
||||
public BlockGeneratorLimitRemover() {
|
||||
super("generator_limit_remover", TileEntityGeneratorLimitRemover::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public Tuple<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new);
|
||||
public Tuple<TileEntityType<TileEntityGeneratorLimitRemover>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityGeneratorLimitRemover>>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, () -> RenderGeneratorLimitRemover::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TileEntityNatureAltar> {
|
||||
|
||||
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<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.NATURE_ALTAR, RenderNatureAltar::new);
|
||||
public Tuple<TileEntityType<TileEntityNatureAltar>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityNatureAltar>>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.NATURE_ALTAR, () -> RenderNatureAltar::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TileEntityOfferingTable> {
|
||||
|
||||
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<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.OFFERING_TABLE, RenderOfferingTable::new);
|
||||
public Tuple<TileEntityType<TileEntityOfferingTable>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityOfferingTable>>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.OFFERING_TABLE, () -> RenderOfferingTable::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TileEntityProjectileGenerator> {
|
||||
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<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new);
|
||||
public Tuple<TileEntityType<TileEntityProjectileGenerator>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityProjectileGenerator>>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, () -> RenderProjectileGenerator::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<TileEntityWoodStand> {
|
||||
|
||||
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<TileEntityType, Function<TileEntityRendererDispatcher, TileEntityRenderer<? extends TileEntity>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.WOOD_STAND, RenderWoodStand::new);
|
||||
public Tuple<TileEntityType<TileEntityWoodStand>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityWoodStand>>>> getTESR() {
|
||||
return new Tuple<>(ModTileEntities.WOOD_STAND, () -> RenderWoodStand::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<NoFeatureConfig> {
|
||||
// TODO figure out if this still works like it should
|
||||
public class WorldGenAncientTree extends AbstractTreeFeature<TreeFeatureConfig> {
|
||||
|
||||
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<BlockPos> cb1, Set<BlockPos> 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<NoFeatureConfig> {
|
|||
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<NoFeatureConfig> {
|
|||
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<NoFeatureConfig> {
|
|||
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<NoFeatureConfig> {
|
|||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ public class ClientProxy implements IProxy {
|
|||
|
||||
@Override
|
||||
public void registerTESR(ITESRProvider provider) {
|
||||
Tuple<TileEntityType, Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntity>>> tesr = provider.getTESR();
|
||||
ClientRegistry.bindTileEntityRenderer(tesr.getA(), tesr.getB());
|
||||
Tuple<TileEntityType<TileEntity>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntity>>>> tesr = provider.getTESR();
|
||||
ClientRegistry.bindTileEntityRenderer(tesr.getA(), tesr.getB().get());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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<T extends TileEntity> {
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
Tuple<TileEntityType, Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntity>>> getTESR();
|
||||
Tuple<TileEntityType<T>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super T>>>> getTESR();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue