models DONE MY GOD

This commit is contained in:
Ellpeck 2020-01-29 01:34:58 +01:00
parent 31b0ced5e4
commit 76e8fa9008
65 changed files with 570 additions and 111 deletions

View file

@ -1,7 +1,19 @@
{ {
"variants": { "variants": {
"": { "facing=north": {
"model": "naturesaura:block/auto_crafter" "model": "naturesaura:block/auto_crafter"
},
"facing=south": {
"model": "naturesaura:block/auto_crafter",
"y": 180
},
"facing=west": {
"model": "naturesaura:block/auto_crafter",
"y": 270
},
"facing=east": {
"model": "naturesaura:block/auto_crafter",
"y": 90
} }
} }
} }

View file

@ -1,7 +1,19 @@
{ {
"variants": { "variants": {
"": { "facing=north": {
"model": "naturesaura:block/blast_furnace_booster" "model": "naturesaura:block/blast_furnace_booster"
},
"facing=south": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 180
},
"facing=west": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 270
},
"facing=east": {
"model": "naturesaura:block/blast_furnace_booster",
"y": 90
} }
} }
} }

View file

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "naturesaura:block/dimension_rail_end"
}
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "naturesaura:block/dimension_rail_nether"
}
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "naturesaura:block/dimension_rail_overworld"
}
}
}

View file

@ -1,7 +1,30 @@
{ {
"variants": { "variants": {
"": { "facing=down": {
"model": "naturesaura:block/furnace_heater",
"x": 180
},
"facing=up": {
"model": "naturesaura:block/furnace_heater" "model": "naturesaura:block/furnace_heater"
},
"facing=north": {
"model": "naturesaura:block/furnace_heater",
"x": 90
},
"facing=south": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 180
},
"facing=west": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 270
},
"facing=east": {
"model": "naturesaura:block/furnace_heater",
"x": 90,
"y": 90
} }
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/animal_generator" "side": "naturesaura:block/animal_generator",
"bottom": "naturesaura:block/animal_generator_bottom",
"top": "naturesaura:block/animal_generator_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/auto_crafter" "side": "naturesaura:block/auto_crafter",
"bottom": "naturesaura:block/auto_crafter_bottom",
"top": "naturesaura:block/auto_crafter_top"
} }
} }

View file

@ -1,6 +0,0 @@
{
"parent": "block/cube_all",
"textures": {
"all": "naturesaura:block/dimension_rail_end"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "block/cube_all",
"textures": {
"all": "naturesaura:block/dimension_rail_nether"
}
}

View file

@ -1,6 +0,0 @@
{
"parent": "block/cube_all",
"textures": {
"all": "naturesaura:block/dimension_rail_overworld"
}
}

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/ender_crate" "side": "naturesaura:block/ender_crate",
"bottom": "naturesaura:block/ender_crate_bottom",
"top": "naturesaura:block/ender_crate_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/firework_generator" "side": "naturesaura:block/firework_generator",
"bottom": "naturesaura:block/firework_generator_top",
"top": "naturesaura:block/firework_generator_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/flower_generator" "side": "naturesaura:block/flower_generator",
"bottom": "naturesaura:block/flower_generator_top",
"top": "naturesaura:block/flower_generator_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/generator_limit_remover" "side": "naturesaura:block/generator_limit_remover",
"bottom": "naturesaura:block/generator_limit_remover_top",
"top": "naturesaura:block/generator_limit_remover_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/oak_generator" "side": "naturesaura:block/oak_generator",
"bottom": "naturesaura:block/oak_generator_bottom",
"top": "naturesaura:block/oak_generator_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/pickup_stopper" "side": "naturesaura:block/pickup_stopper",
"bottom": "naturesaura:block/pickup_stopper_top",
"top": "naturesaura:block/pickup_stopper_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/placer" "side": "naturesaura:block/placer",
"bottom": "naturesaura:block/placer_top",
"top": "naturesaura:block/placer_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/potion_generator" "side": "naturesaura:block/potion_generator",
"bottom": "naturesaura:block/potion_generator_bottom",
"top": "naturesaura:block/potion_generator_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/projectile_generator" "side": "naturesaura:block/projectile_generator",
"bottom": "naturesaura:block/projectile_generator_top",
"top": "naturesaura:block/projectile_generator_top"
} }
} }

View file

@ -1,6 +1,8 @@
{ {
"parent": "block/cube_all", "parent": "block/cube_bottom_top",
"textures": { "textures": {
"all": "naturesaura:block/time_changer" "side": "naturesaura:block/time_changer",
"bottom": "naturesaura:block/time_changer_bottom",
"top": "naturesaura:block/time_changer_top"
} }
} }

View file

@ -1,6 +1,7 @@
{ {
"parent": "item/generated", "parent": "item/generated",
"textures": { "textures": {
"layer0": "naturesaura:item/aura_bottle" "layer0": "naturesaura:item/aura_bottle",
"layer1": "naturesaura:item/aura_bottle_overlay"
} }
} }

View file

@ -1,3 +1,6 @@
{ {
"parent": "naturesaura:block/dimension_rail_end" "parent": "item/generated",
"textures": {
"layer0": "naturesaura:block/dimension_rail_end"
}
} }

View file

@ -1,3 +1,6 @@
{ {
"parent": "naturesaura:block/dimension_rail_nether" "parent": "item/generated",
"textures": {
"layer0": "naturesaura:block/dimension_rail_nether"
}
} }

View file

@ -1,3 +1,6 @@
{ {
"parent": "naturesaura:block/dimension_rail_overworld" "parent": "item/generated",
"textures": {
"layer0": "naturesaura:block/dimension_rail_overworld"
}
} }

View file

@ -3,12 +3,10 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.data.BlockStateGenerator; import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.data.ItemModelGenerator; import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.gen.WorldGenAncientTree; import de.ellpeck.naturesaura.gen.WorldGenAncientTree;
import de.ellpeck.naturesaura.reg.ICustomBlockState; import de.ellpeck.naturesaura.reg.*;
import de.ellpeck.naturesaura.reg.ICustomItemModel;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.ISelectionContext;
@ -19,8 +17,9 @@ import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.event.ForgeEventFactory;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier;
public class BlockAncientSapling extends BushBlock implements IGrowable, IModItem, ICustomBlockState, ICustomItemModel { public class BlockAncientSapling extends BushBlock implements IGrowable, IModItem, ICustomBlockState, ICustomItemModel, ICustomRenderType {
protected static final VoxelShape SHAPE = Block.makeCuboidShape(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); protected static final VoxelShape SHAPE = Block.makeCuboidShape(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
public BlockAncientSapling() { public BlockAncientSapling() {
@ -82,4 +81,9 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte
public void generateCustomItemModel(ItemModelGenerator generator) { public void generateCustomItemModel(ItemModelGenerator generator) {
generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName()); generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName());
} }
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
}
} }

View file

@ -4,8 +4,10 @@ import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.INPC; import net.minecraft.entity.INPC;
@ -26,9 +28,9 @@ import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable { public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockAnimalGenerator() { public BlockAnimalGenerator() {
super("animal_generator", () -> new TileEntityAnimalGenerator(), ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); super("animal_generator", TileEntityAnimalGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@ -107,4 +109,12 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
public int getVisualizationColor(World world, BlockPos pos) { public int getVisualizationColor(World world, BlockPos pos) {
return 0x11377a; return 0x11377a;
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -1,7 +1,8 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
@ -11,7 +12,7 @@ import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
public class BlockAutoCrafter extends BlockContainerImpl { public class BlockAutoCrafter extends BlockContainerImpl implements ICustomBlockState {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public BlockAutoCrafter() { public BlockAutoCrafter() {
@ -27,4 +28,12 @@ public class BlockAutoCrafter extends BlockContainerImpl {
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState().with(FACING, context.getPlayer().getHorizontalFacing()); return this.getDefaultState().with(FACING, context.getPlayer().getHorizontalFacing());
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.horizontalBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -41,6 +41,6 @@ public class BlockBlastFurnaceBooster extends BlockContainerImpl implements ICus
@Override @Override
public void generateCustomBlockState(BlockStateGenerator generator) { public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName()))); generator.horizontalBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
} }
} }

View file

@ -2,20 +2,23 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.data.BlockStateGenerator; import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState; import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ICustomRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier;
public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState { public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState, ICustomRenderType {
public BlockDecayedLeaves() { public BlockDecayedLeaves() {
super("decayed_leaves", ModBlocks.prop(Material.LEAVES).hardnessAndResistance(0.2F).sound(SoundType.PLANT).variableOpacity().notSolid().tickRandomly()); super("decayed_leaves", ModBlocks.prop(Material.LEAVES).hardnessAndResistance(0.2F).sound(SoundType.PLANT).notSolid().tickRandomly());
} }
@Override @Override
@ -34,4 +37,9 @@ public class BlockDecayedLeaves extends BlockImpl implements ICustomBlockState {
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) { public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
return 1; return 1;
} }
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
}
} }

View file

@ -1,16 +1,18 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.packet.PacketClient; import de.ellpeck.naturesaura.packet.PacketClient;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.*;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.AbstractRailBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -40,8 +42,9 @@ import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
public class BlockDimensionRail extends AbstractRailBlock implements IModItem { public class BlockDimensionRail extends AbstractRailBlock implements IModItem, ICustomRenderType, ICustomBlockState, ICustomItemModel {
public static final EnumProperty<RailShape> SHAPE = BlockStateProperties.RAIL_SHAPE; public static final EnumProperty<RailShape> SHAPE = BlockStateProperties.RAIL_SHAPE;
@ -139,6 +142,7 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem {
return SHAPE; return SHAPE;
} }
@Override
public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos) { public boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos) {
return false; return false;
} }
@ -157,4 +161,19 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem {
public String getBaseName() { public String getBaseName() {
return "dimension_rail_" + this.name; return "dimension_rail_" + this.name;
} }
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
}
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
// noop
}
@Override
public void generateCustomItemModel(ItemModelGenerator generator) {
generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName());
}
} }

View file

@ -6,6 +6,7 @@ import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.*; import de.ellpeck.naturesaura.reg.*;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.boss.dragon.EnderDragonEntity; import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -29,8 +30,9 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockState, ICustomItemModel { public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockState, ICustomItemModel, ICustomRenderType {
protected static final VoxelShape SHAPE = Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D); protected static final VoxelShape SHAPE = Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
@ -122,4 +124,9 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
public void generateCustomItemModel(ItemModelGenerator generator) { public void generateCustomItemModel(ItemModelGenerator generator) {
generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName()); generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "block/" + this.getBaseName());
} }
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutout;
}
} }

View file

@ -5,7 +5,9 @@ import de.ellpeck.naturesaura.api.misc.IWorldData;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.block.AnvilBlock; import net.minecraft.block.AnvilBlock;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -48,7 +50,7 @@ import java.util.Random;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider<TileEntityEnderCrate> { public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider<TileEntityEnderCrate>, ICustomBlockState {
// This is terrible but I can't see a better solution right now so oh well // 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<>(); private static final ThreadLocal<WeakReference<World>> CACHED_WORLD = new ThreadLocal<>();
@ -149,4 +151,12 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider
public Tuple<TileEntityType<TileEntityEnderCrate>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityEnderCrate>>>> getTESR() { public Tuple<TileEntityType<TileEntityEnderCrate>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityEnderCrate>>>> getTESR() {
return new Tuple<>(ModTileEntities.ENDER_CRATE, () -> RenderEnderCrate::new); return new Tuple<>(ModTileEntities.ENDER_CRATE, () -> RenderEnderCrate::new);
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -5,9 +5,11 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator;
import de.ellpeck.naturesaura.data.BlockStateGenerator; import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState; import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ICustomRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -22,8 +24,9 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier;
public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState { public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState, ICustomRenderType {
public BlockFieldCreator() { public BlockFieldCreator() {
super("field_creator", TileEntityFieldCreator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); super("field_creator", TileEntityFieldCreator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
} }
@ -100,4 +103,9 @@ public class BlockFieldCreator extends BlockContainerImpl implements ICustomBloc
public void generateCustomBlockState(BlockStateGenerator generator) { public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName()))); generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
} }
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
}
} }

View file

@ -1,8 +1,9 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFireworkGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFireworkGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -11,7 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable { public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockFireworkGenerator() { public BlockFireworkGenerator() {
super("firework_generator", TileEntityFireworkGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE)); super("firework_generator", TileEntityFireworkGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(3F).sound(SoundType.STONE));
} }
@ -27,4 +28,12 @@ public class BlockFireworkGenerator extends BlockContainerImpl implements IVisua
public int getVisualizationColor(World world, BlockPos pos) { public int getVisualizationColor(World world, BlockPos pos) {
return 0xa442f4; return 0xa442f4;
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_top"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -2,6 +2,8 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityFlowerGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFlowerGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -10,7 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable { public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockFlowerGenerator() { public BlockFlowerGenerator() {
super("flower_generator", TileEntityFlowerGenerator::new, ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F)); super("flower_generator", TileEntityFlowerGenerator::new, ModBlocks.prop(Material.WOOD).sound(SoundType.WOOD).hardnessAndResistance(2F));
@ -27,4 +29,12 @@ public class BlockFlowerGenerator extends BlockContainerImpl implements IVisuali
public int getVisualizationColor(World world, BlockPos pos) { public int getVisualizationColor(World world, BlockPos pos) {
return 0xffed2b; return 0xffed2b;
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_top"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -97,6 +97,6 @@ public class BlockFurnaceHeater extends BlockContainerImpl implements ICustomBlo
@Override @Override
public void generateCustomBlockState(BlockStateGenerator generator) { public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName()))); generator.directionalBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
} }
} }

View file

@ -3,6 +3,8 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover; import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -14,7 +16,7 @@ import net.minecraft.util.Tuple;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider<TileEntityGeneratorLimitRemover> { public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider<TileEntityGeneratorLimitRemover>, ICustomBlockState {
public BlockGeneratorLimitRemover() { public BlockGeneratorLimitRemover() {
super("generator_limit_remover", TileEntityGeneratorLimitRemover::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); super("generator_limit_remover", TileEntityGeneratorLimitRemover::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
@ -24,4 +26,12 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT
public Tuple<TileEntityType<TileEntityGeneratorLimitRemover>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityGeneratorLimitRemover>>>> getTESR() { public Tuple<TileEntityType<TileEntityGeneratorLimitRemover>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityGeneratorLimitRemover>>>> getTESR() {
return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, () -> RenderGeneratorLimitRemover::new); return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, () -> RenderGeneratorLimitRemover::new);
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_top"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -5,10 +5,12 @@ import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingBlock;
import de.ellpeck.naturesaura.reg.ICustomBlockState; import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ICustomItemModel; import de.ellpeck.naturesaura.reg.ICustomItemModel;
import de.ellpeck.naturesaura.reg.ICustomRenderType;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.RedstoneWireBlock; import net.minecraft.block.RedstoneWireBlock;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
@ -25,7 +27,9 @@ import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock, ICustomBlockState, ICustomItemModel { import java.util.function.Supplier;
public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock, ICustomBlockState, ICustomItemModel, ICustomRenderType {
public static final EnumProperty<RedstoneSide> NORTH = BlockStateProperties.REDSTONE_NORTH; public static final EnumProperty<RedstoneSide> NORTH = BlockStateProperties.REDSTONE_NORTH;
public static final EnumProperty<RedstoneSide> EAST = BlockStateProperties.REDSTONE_EAST; public static final EnumProperty<RedstoneSide> EAST = BlockStateProperties.REDSTONE_EAST;
@ -228,4 +232,9 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock,
public void generateCustomItemModel(ItemModelGenerator generator) { public void generateCustomItemModel(ItemModelGenerator generator) {
generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "item/" + this.getBaseName()); generator.withExistingParent(this.getBaseName(), "item/generated").texture("layer0", "item/" + this.getBaseName());
} }
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
}
} }

View file

@ -6,6 +6,8 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOakGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityOakGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.SaplingBlock; import net.minecraft.block.SaplingBlock;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -21,7 +23,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.Random; import java.util.Random;
public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable { public class BlockOakGenerator extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockOakGenerator() { public BlockOakGenerator() {
super("oak_generator", TileEntityOakGenerator::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD)); super("oak_generator", TileEntityOakGenerator::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD));
@ -67,4 +69,13 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
public int getVisualizationColor(World world, BlockPos pos) { public int getVisualizationColor(World world, BlockPos pos) {
return 0x2e7a11; return 0x2e7a11;
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -3,8 +3,10 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPickupStopper; import de.ellpeck.naturesaura.blocks.tiles.TileEntityPickupStopper;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
@ -19,7 +21,7 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable { public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockPickupStopper() { public BlockPickupStopper() {
super("pickup_stopper", TileEntityPickupStopper::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE)); super("pickup_stopper", TileEntityPickupStopper::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2F).sound(SoundType.STONE));
@ -70,4 +72,12 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza
public int getVisualizationColor(World world, BlockPos pos) { public int getVisualizationColor(World world, BlockPos pos) {
return 0xf4aa42; return 0xf4aa42;
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_top"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -1,8 +1,9 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPlacer; import de.ellpeck.naturesaura.blocks.tiles.TileEntityPlacer;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -11,7 +12,7 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockPlacer extends BlockContainerImpl implements IVisualizable { public class BlockPlacer extends BlockContainerImpl implements IVisualizable, ICustomBlockState {
public BlockPlacer() { public BlockPlacer() {
super("placer", TileEntityPlacer::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); super("placer", TileEntityPlacer::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
@ -28,4 +29,12 @@ public class BlockPlacer extends BlockContainerImpl implements IVisualizable {
public int getVisualizationColor(World world, BlockPos pos) { public int getVisualizationColor(World world, BlockPos pos) {
return 0x078a93; return 0x078a93;
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_top"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -1,12 +1,21 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPotionGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityPotionGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraftforge.common.ToolType; import net.minecraftforge.common.ToolType;
public class BlockPotionGenerator extends BlockContainerImpl { public class BlockPotionGenerator extends BlockContainerImpl implements ICustomBlockState {
public BlockPotionGenerator() { public BlockPotionGenerator() {
super("potion_generator", TileEntityPotionGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).harvestTool(ToolType.PICKAXE).harvestLevel(1)); super("potion_generator", TileEntityPotionGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(5F).harvestTool(ToolType.PICKAXE).harvestLevel(1));
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -5,8 +5,10 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator; import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -28,7 +30,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<TileEntityProjectileGenerator> { public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider<TileEntityProjectileGenerator>, ICustomBlockState {
public BlockProjectileGenerator() { public BlockProjectileGenerator() {
super("projectile_generator", TileEntityProjectileGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); super("projectile_generator", TileEntityProjectileGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
@ -77,4 +79,12 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES
public Tuple<TileEntityType<TileEntityProjectileGenerator>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityProjectileGenerator>>>> getTESR() { public Tuple<TileEntityType<TileEntityProjectileGenerator>, Supplier<Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super TileEntityProjectileGenerator>>>> getTESR() {
return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, () -> RenderProjectileGenerator::new); return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, () -> RenderProjectileGenerator::new);
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_top"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -8,9 +8,11 @@ import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import de.ellpeck.naturesaura.reg.ICustomBlockState; import de.ellpeck.naturesaura.reg.ICustomBlockState;
import de.ellpeck.naturesaura.reg.ICustomRenderType;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.entity.MobEntity; import net.minecraft.entity.MobEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
@ -29,7 +31,9 @@ import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable, ICustomBlockState { import java.util.function.Supplier;
public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable, ICustomBlockState, ICustomRenderType {
private static final VoxelShape SHAPE = VoxelShapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F); private static final VoxelShape SHAPE = VoxelShapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
@ -97,4 +101,9 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable,
public void generateCustomBlockState(BlockStateGenerator generator) { public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName()))); generator.simpleBlock(this, generator.models().getExistingFile(generator.modLoc(this.getBaseName())));
} }
@Override
public Supplier<RenderType> getRenderType() {
return RenderType::cutoutMipped;
}
} }

View file

@ -1,12 +1,21 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityTimeChanger; import de.ellpeck.naturesaura.blocks.tiles.TileEntityTimeChanger;
import de.ellpeck.naturesaura.data.BlockStateGenerator;
import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
public class BlockTimeChanger extends BlockContainerImpl { public class BlockTimeChanger extends BlockContainerImpl implements ICustomBlockState {
public BlockTimeChanger() { public BlockTimeChanger() {
super("time_changer", TileEntityTimeChanger::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); super("time_changer", TileEntityTimeChanger::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE));
} }
@Override
public void generateCustomBlockState(BlockStateGenerator generator) {
generator.simpleBlock(this, generator.models().cubeBottomTop(this.getBaseName(),
generator.modLoc("block/" + this.getBaseName()),
generator.modLoc("block/" + this.getBaseName() + "_bottom"),
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
} }

View file

@ -4,7 +4,9 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import de.ellpeck.naturesaura.reg.ICustomItemModel;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.DispenserBlock; import net.minecraft.block.DispenserBlock;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
@ -27,7 +29,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import static net.minecraft.dispenser.DefaultDispenseItemBehavior.doDispense; import static net.minecraft.dispenser.DefaultDispenseItemBehavior.doDispense;
public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem, ICustomItemModel {
public ItemAuraBottle(Item emptyBottle) { public ItemAuraBottle(Item emptyBottle) {
super("aura_bottle", new Properties().group(NaturesAura.CREATIVE_TAB)); super("aura_bottle", new Properties().group(NaturesAura.CREATIVE_TAB));
@ -91,6 +93,13 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem {
return (stack, tintIndex) -> tintIndex > 0 ? getType(stack).getColor() : 0xFFFFFF; return (stack, tintIndex) -> tintIndex > 0 ? getType(stack).getColor() : 0xFFFFFF;
} }
@Override
public void generateCustomItemModel(ItemModelGenerator generator) {
generator.withExistingParent(this.getBaseName(), "item/generated")
.texture("layer0", "item/" + this.getBaseName())
.texture("layer1", "item/" + this.getBaseName() + "_overlay");
}
private class EventHandler { private class EventHandler {
@SubscribeEvent @SubscribeEvent

View file

@ -2,7 +2,9 @@ package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.data.ItemModelGenerator;
import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import de.ellpeck.naturesaura.reg.ICustomItemModel;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -16,7 +18,7 @@ import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { public class ItemColorChanger extends ItemImpl implements IColorProvidingItem, ICustomItemModel {
public ItemColorChanger() { public ItemColorChanger() {
super("color_changer", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB)); super("color_changer", new Properties().maxStackSize(1).group(NaturesAura.CREATIVE_TAB));
@ -40,6 +42,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) { private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
for (IProperty prop : state.getProperties()) { for (IProperty prop : state.getProperties()) {
// TODO Fix this since it's now not state-based anymore
if (prop.getValueClass() == DyeColor.class) { if (prop.getValueClass() == DyeColor.class) {
DyeColor color = (DyeColor) state.get(prop); DyeColor color = (DyeColor) state.get(prop);
if (firstColor == null || color == firstColor) { if (firstColor == null || color == firstColor) {
@ -130,4 +133,9 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem {
return 0xFFFFFF; return 0xFFFFFF;
}; };
} }
@Override
public void generateCustomItemModel(ItemModelGenerator generator) {
// noop
}
} }

View file

@ -6,14 +6,13 @@ import de.ellpeck.naturesaura.gui.GuiEnderCrate;
import de.ellpeck.naturesaura.gui.ModContainers; import de.ellpeck.naturesaura.gui.ModContainers;
import de.ellpeck.naturesaura.particles.ParticleHandler; import de.ellpeck.naturesaura.particles.ParticleHandler;
import de.ellpeck.naturesaura.particles.ParticleMagic; import de.ellpeck.naturesaura.particles.ParticleMagic;
import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.*;
import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import de.ellpeck.naturesaura.reg.ITESRProvider;
import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets; import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets;
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScreenManager; import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.entity.PlayerRenderer; import net.minecraft.client.renderer.entity.PlayerRenderer;
@ -55,7 +54,10 @@ public class ClientProxy implements IProxy {
@Override @Override
public void postInit(FMLCommonSetupEvent event) { public void postInit(FMLCommonSetupEvent event) {
for (IModItem item : ModRegistry.ALL_ITEMS) {
if (item instanceof ICustomRenderType)
RenderTypeLookup.setRenderLayer((Block) item, ((ICustomRenderType) item).getRenderType().get());
}
} }
@Override @Override

View file

@ -0,0 +1,10 @@
package de.ellpeck.naturesaura.reg;
import net.minecraft.client.renderer.RenderType;
import java.util.function.Supplier;
public interface ICustomRenderType {
Supplier<RenderType> getRenderType();
}

View file

@ -0,0 +1,40 @@
{
"variants": {
"shape=north_south": {
"model": "naturesaura:block/dimension_rail_end"
},
"shape=east_west": {
"model": "naturesaura:block/dimension_rail_end",
"y": 90
},
"shape=ascending_east": {
"model": "naturesaura:block/dimension_rail_end_raised_ne",
"y": 90
},
"shape=ascending_west": {
"model": "naturesaura:block/dimension_rail_end_raised_sw",
"y": 90
},
"shape=ascending_north": {
"model": "naturesaura:block/dimension_rail_end_raised_ne"
},
"shape=ascending_south": {
"model": "naturesaura:block/dimension_rail_end_raised_sw"
},
"shape=south_east": {
"model": "naturesaura:block/dimension_rail_end"
},
"shape=south_west": {
"model": "naturesaura:block/dimension_rail_end",
"y": 90
},
"shape=north_west": {
"model": "naturesaura:block/dimension_rail_end",
"y": 180
},
"shape=north_east": {
"model": "naturesaura:block/dimension_rail_end",
"y": 270
}
}
}

View file

@ -0,0 +1,40 @@
{
"variants": {
"shape=north_south": {
"model": "naturesaura:block/dimension_rail_nether"
},
"shape=east_west": {
"model": "naturesaura:block/dimension_rail_nether",
"y": 90
},
"shape=ascending_east": {
"model": "naturesaura:block/dimension_rail_nether_raised_ne",
"y": 90
},
"shape=ascending_west": {
"model": "naturesaura:block/dimension_rail_nether_raised_sw",
"y": 90
},
"shape=ascending_north": {
"model": "naturesaura:block/dimension_rail_nether_raised_ne"
},
"shape=ascending_south": {
"model": "naturesaura:block/dimension_rail_nether_raised_sw"
},
"shape=south_east": {
"model": "naturesaura:block/dimension_rail_end"
},
"shape=south_west": {
"model": "naturesaura:block/dimension_rail_end",
"y": 90
},
"shape=north_west": {
"model": "naturesaura:block/dimension_rail_end",
"y": 180
},
"shape=north_east": {
"model": "naturesaura:block/dimension_rail_end",
"y": 270
}
}
}

View file

@ -0,0 +1,40 @@
{
"variants": {
"shape=north_south": {
"model": "naturesaura:block/dimension_rail_overworld"
},
"shape=east_west": {
"model": "naturesaura:block/dimension_rail_overworld",
"y": 90
},
"shape=ascending_east": {
"model": "naturesaura:block/dimension_rail_overworld_raised_ne",
"y": 90
},
"shape=ascending_west": {
"model": "naturesaura:block/dimension_rail_overworld_raised_sw",
"y": 90
},
"shape=ascending_north": {
"model": "naturesaura:block/dimension_rail_overworld_raised_ne"
},
"shape=ascending_south": {
"model": "naturesaura:block/dimension_rail_overworld_raised_sw"
},
"shape=south_east": {
"model": "naturesaura:block/dimension_rail_end"
},
"shape=south_west": {
"model": "naturesaura:block/dimension_rail_end",
"y": 90
},
"shape=north_west": {
"model": "naturesaura:block/dimension_rail_end",
"y": 180
},
"shape=north_east": {
"model": "naturesaura:block/dimension_rail_end",
"y": 270
}
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/rail_flat",
"textures": {
"rail": "naturesaura:block/dimension_rail_end"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/template_rail_raised_ne",
"textures": {
"rail": "naturesaura:block/dimension_rail_end"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/template_rail_raised_sw",
"textures": {
"rail": "naturesaura:block/dimension_rail_end"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/rail_flat",
"textures": {
"rail": "naturesaura:block/dimension_rail_nether"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/template_rail_raised_ne",
"textures": {
"rail": "naturesaura:block/dimension_rail_nether"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/template_rail_raised_sw",
"textures": {
"rail": "naturesaura:block/dimension_rail_nether"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/rail_flat",
"textures": {
"rail": "naturesaura:block/dimension_rail_overworld"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/template_rail_raised_ne",
"textures": {
"rail": "naturesaura:block/dimension_rail_overworld"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "block/template_rail_raised_sw",
"textures": {
"rail": "naturesaura:block/dimension_rail_overworld"
}
}

View file

@ -0,0 +1,20 @@
{
"parent": "item/generated",
"textures": {
"layer0": "naturesaura:item/color_changer"
},
"overrides": [
{
"predicate": {
"naturesaura:has_color": 1
},
"model": "naturesaura:item/color_changer_filled"
},
{
"predicate": {
"naturesaura:fill_mode": 1
},
"model": "naturesaura:item/color_changer_fill_mode"
}
]
}

View file

@ -0,0 +1,7 @@
{
"parent": "item/generated",
"textures": {
"layer0": "naturesaura:item/color_changer_fill_mode",
"layer1": "naturesaura:item/color_changer_fill_mode_overlay"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "item/generated",
"textures": {
"layer0": "naturesaura:item/color_changer",
"layer1": "naturesaura:item/color_changer_overlay"
}
}