Ported window blocks

- window and glass blocks entered the registrate
- updated palette textures
- removed windowlogging
- removed cocoa logs
This commit is contained in:
simibubi 2020-05-14 01:23:15 +02:00
parent 7536e22eed
commit deb03d10de
480 changed files with 250 additions and 3275 deletions

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/acacia_window"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/birch_window"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/dark_oak_window"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/jungle_window"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/oak_window"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/ornate_iron_window"
}
}
}

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "create:block/spruce_window"
}
}
}

View file

@ -1,13 +1,16 @@
{
"block.create.acacia_window": "\u028Dopu\u0131M \u0250\u0131\u0254\u0250\u0254\u2C6F",
"block.create.andesite_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DD\u0287\u0131s\u01DDpu\u2C6F",
"block.create.andesite_cobblestone": "\u01DDuo\u0287s\u01DD\u05DFqqo\u0186 \u01DD\u0287\u0131s\u01DDpu\u2C6F",
"block.create.andesite_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 \u01DD\u0287\u0131s\u01DDpu\u2C6F",
"block.create.birch_window": "\u028Dopu\u0131M \u0265\u0254\u0279\u0131\u15FA",
"block.create.chiseled_dark_scoria": "\u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1 p\u01DD\u05DF\u01DDs\u0131\u0265\u0186",
"block.create.chiseled_dolomite": "\u01DD\u0287\u0131\u026Fo\u05DFo\u15E1 p\u01DD\u05DF\u01DDs\u0131\u0265\u0186",
"block.create.chiseled_gabbro": "o\u0279qq\u0250\u2141 p\u01DD\u05DF\u01DDs\u0131\u0265\u0186",
"block.create.chiseled_limestone": "\u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u05DF\u01DDs\u0131\u0265\u0186",
"block.create.chiseled_scoria": "\u0250\u0131\u0279o\u0254S p\u01DD\u05DF\u01DDs\u0131\u0265\u0186",
"block.create.chiseled_weathered_limestone": "\u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM p\u01DD\u05DF\u01DDs\u0131\u0265\u0186",
"block.create.dark_oak_window": "\u028Dopu\u0131M \u029E\u0250O \u029E\u0279\u0250\u15E1",
"block.create.dark_scoria": "\u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
"block.create.dark_scoria_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
"block.create.dark_scoria_cobblestone": "\u01DDuo\u0287s\u01DD\u05DFqqo\u0186 \u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1",
@ -37,6 +40,7 @@
"block.create.granite_cobblestone": "\u01DDuo\u0287s\u01DD\u05DFqqo\u0186 \u01DD\u0287\u0131u\u0250\u0279\u2141",
"block.create.granite_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 \u01DD\u0287\u0131u\u0250\u0279\u2141",
"block.create.horizontal_framed_glass": "ss\u0250\u05DF\u2141 p\u01DD\u026F\u0250\u0279\u2132 \u05DF\u0250\u0287uoz\u0131\u0279oH",
"block.create.jungle_window": "\u028Dopu\u0131M \u01DD\u05DFbun\u017F",
"block.create.layered_andesite": "\u01DD\u0287\u0131s\u01DDpu\u2C6F p\u01DD\u0279\u01DD\u028E\u0250\uA780",
"block.create.layered_dark_scoria": "\u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1 p\u01DD\u0279\u01DD\u028E\u0250\uA780",
"block.create.layered_diorite": "\u01DD\u0287\u0131\u0279o\u0131\u15E1 p\u01DD\u0279\u01DD\u028E\u0250\uA780",
@ -61,6 +65,8 @@
"block.create.mossy_scoria": "\u0250\u0131\u0279o\u0254S \u028EssoW",
"block.create.mossy_weathered_limestone": "\u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM \u028EssoW",
"block.create.natural_scoria": "\u0250\u0131\u0279o\u0254S \u05DF\u0250\u0279n\u0287\u0250N",
"block.create.oak_window": "\u028Dopu\u0131M \u029E\u0250O",
"block.create.ornate_iron_window": "\u028Dopu\u0131M uo\u0279I \u01DD\u0287\u0250u\u0279O",
"block.create.overgrown_andesite": "\u01DD\u0287\u0131s\u01DDpu\u2C6F u\u028Do\u0279b\u0279\u01DD\u028CO",
"block.create.overgrown_dark_scoria": "\u0250\u0131\u0279o\u0254S \u029E\u0279\u0250\u15E1 u\u028Do\u0279b\u0279\u01DD\u028CO",
"block.create.overgrown_diorite": "\u01DD\u0287\u0131\u0279o\u0131\u15E1 u\u028Do\u0279b\u0279\u01DD\u028CO",
@ -89,6 +95,7 @@
"block.create.scoria_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u0250\u0131\u0279o\u0254S",
"block.create.scoria_cobblestone": "\u01DDuo\u0287s\u01DD\u05DFqqo\u0186 \u0250\u0131\u0279o\u0254S",
"block.create.scoria_pillar": "\u0279\u0250\u05DF\u05DF\u0131\u0500 \u0250\u0131\u0279o\u0254S",
"block.create.spruce_window": "\u028Dopu\u0131M \u01DD\u0254n\u0279dS",
"block.create.vertical_framed_glass": "ss\u0250\u05DF\u2141 p\u01DD\u026F\u0250\u0279\u2132 \u05DF\u0250\u0254\u0131\u0287\u0279\u01DD\u039B",
"block.create.weathered_limestone": "\u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM",
"block.create.weathered_limestone_bricks": "s\u029E\u0254\u0131\u0279\u15FA \u01DDuo\u0287s\u01DD\u026F\u0131\uA780 p\u01DD\u0279\u01DD\u0265\u0287\u0250\u01DDM",

View file

@ -1,13 +1,16 @@
{
"block.create.acacia_window": "Acacia Window",
"block.create.andesite_bricks": "Andesite Bricks",
"block.create.andesite_cobblestone": "Andesite Cobblestone",
"block.create.andesite_pillar": "Andesite Pillar",
"block.create.birch_window": "Birch Window",
"block.create.chiseled_dark_scoria": "Chiseled Dark Scoria",
"block.create.chiseled_dolomite": "Chiseled Dolomite",
"block.create.chiseled_gabbro": "Chiseled Gabbro",
"block.create.chiseled_limestone": "Chiseled Limestone",
"block.create.chiseled_scoria": "Chiseled Scoria",
"block.create.chiseled_weathered_limestone": "Chiseled Weathered Limestone",
"block.create.dark_oak_window": "Dark Oak Window",
"block.create.dark_scoria": "Dark Scoria",
"block.create.dark_scoria_bricks": "Dark Scoria Bricks",
"block.create.dark_scoria_cobblestone": "Dark Scoria Cobblestone",
@ -37,6 +40,7 @@
"block.create.granite_cobblestone": "Granite Cobblestone",
"block.create.granite_pillar": "Granite Pillar",
"block.create.horizontal_framed_glass": "Horizontal Framed Glass",
"block.create.jungle_window": "Jungle Window",
"block.create.layered_andesite": "Layered Andesite",
"block.create.layered_dark_scoria": "Layered Dark Scoria",
"block.create.layered_diorite": "Layered Diorite",
@ -61,6 +65,8 @@
"block.create.mossy_scoria": "Mossy Scoria",
"block.create.mossy_weathered_limestone": "Mossy Weathered Limestone",
"block.create.natural_scoria": "Natural Scoria",
"block.create.oak_window": "Oak Window",
"block.create.ornate_iron_window": "Ornate Iron Window",
"block.create.overgrown_andesite": "Overgrown Andesite",
"block.create.overgrown_dark_scoria": "Overgrown Dark Scoria",
"block.create.overgrown_diorite": "Overgrown Diorite",
@ -89,6 +95,7 @@
"block.create.scoria_bricks": "Scoria Bricks",
"block.create.scoria_cobblestone": "Scoria Cobblestone",
"block.create.scoria_pillar": "Scoria Pillar",
"block.create.spruce_window": "Spruce Window",
"block.create.vertical_framed_glass": "Vertical Framed Glass",
"block.create.weathered_limestone": "Weathered Limestone",
"block.create.weathered_limestone_bricks": "Weathered Limestone Bricks",

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/acacia_window",
"end": "block/acacia_planks"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/birch_window",
"end": "block/birch_planks"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/dark_oak_window",
"end": "block/dark_oak_planks"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/jungle_window",
"end": "block/jungle_planks"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/oak_window",
"end": "block/oak_planks"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/ornate_iron_window",
"end": "create:block/palettes/ornate_iron_window_end"
}
}

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/spruce_window",
"end": "block/spruce_planks"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/acacia_window"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/birch_window"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/dark_oak_window"
}

View file

@ -1,3 +1,7 @@
{
"parent": "create:block/framed_glass"
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/framed_glass",
"end": "create:block/palettes/framed_glass"
}
}

View file

@ -1,3 +1,7 @@
{
"parent": "create:block/horizontal_framed_glass"
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/horizontal_framed_glass",
"end": "create:block/palettes/framed_glass"
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/jungle_window"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/natural_scoria"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/oak_window"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/ornate_iron_window"
}

View file

@ -0,0 +1,3 @@
{
"parent": "create:block/spruce_window"
}

View file

@ -1,3 +1,7 @@
{
"parent": "create:block/vertical_framed_glass"
"parent": "block/cube_column",
"textures": {
"side": "create:block/palettes/vertical_framed_glass",
"end": "create:block/palettes/framed_glass"
}
}

View file

@ -53,8 +53,6 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock;
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock;
import com.simibubi.create.modules.curiosities.CocoaLogBlock;
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.TriplePlaneSymmetryBlock;
@ -214,9 +212,6 @@ public enum AllBlocks implements NonNullSupplier<Block> {
SYMMETRY_PLANE(PlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
SYMMETRY_CROSSPLANE(CrossPlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
SYMMETRY_TRIPLEPLANE(TriplePlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
WINDOW_IN_A_BLOCK(WindowInABlockBlock::new, ComesWith.NO_BLOCKITEM),
COCOA_LOG(CocoaLogBlock::new, ITaggable.create()
.withVanillaTags(ITaggable.BLOCK, "jungle_logs")),
_5_(Sections.SCHEMATICS),

View file

@ -12,18 +12,17 @@ import net.minecraft.util.ResourceLocation;
public enum AllCTs {
FRAMED_GLASS(custom(OMNIDIRECTIONAL, "palettes/framed_glass", "framed_glass")),
HORIZONTAL_FRAMED_GLASS(custom(HORIZONTAL, "palettes/framed_glass", "horizontal_framed_glass")),
VERTICAL_FRAMED_GLASS(custom(VERTICAL, "palettes/framed_glass", "vertical_framed_glass")),
FRAMED_GLASS(custom(OMNIDIRECTIONAL, "palettes/framed_glass", "palettes/framed_glass")),
HORIZONTAL_FRAMED_GLASS(custom(HORIZONTAL, "palettes/framed_glass", "palettes/horizontal_framed_glass")),
VERTICAL_FRAMED_GLASS(custom(VERTICAL, "palettes/framed_glass", "palettes/vertical_framed_glass")),
OAK_GLASS(vertical("oak_window")),
SPRUCE_GLASS(vertical("spruce_window")),
BIRCH_GLASS(vertical("birch_window")),
JUNGLE_GLASS(vertical("jungle_window")),
DARK_OAK_GLASS(vertical("dark_oak_window")),
ACACIA_GLASS(vertical("acacia_window")),
ACACIA_GLASS_DENSE(vertical("acacia_window_dense")),
IRON_GLASS(vertical("iron_window")),
OAK_WINDOW(vertical("palettes/oak_window")),
SPRUCE_WINDOW(vertical("palettes/spruce_window")),
BIRCH_WINDOW(vertical("palettes/birch_window")),
JUNGLE_WINDOW(vertical("palettes/jungle_window")),
ACACIA_WINDOW(vertical("palettes/acacia_window")),
DARK_OAK_WINDOW(vertical("palettes/dark_oak_window")),
ORNATE_IRON_WINDOW(vertical("palettes/ornate_iron_window")),
GRANITE_LAYERS(layers("granite")),
DIORITE_LAYERS(layers("diorite")),

View file

@ -70,7 +70,6 @@ import com.simibubi.create.modules.contraptions.relays.gauge.StressGaugeTileEnti
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxTileEntity;
import com.simibubi.create.modules.contraptions.relays.gearbox.GearboxTileEntityRenderer;
import com.simibubi.create.modules.contraptions.relays.gearbox.GearshiftTileEntity;
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity;
import com.simibubi.create.modules.logistics.block.RedstoneLinkTileEntity;
import com.simibubi.create.modules.logistics.block.StockswitchTileEntity;
import com.simibubi.create.modules.logistics.block.belts.observer.BeltObserverTileEntity;
@ -167,9 +166,6 @@ public enum AllTileEntities {
FLEXPEATER(FlexpeaterTileEntity::new, AllBlocks.FLEXPEATER),
FLEXPULSEPEATER(FlexPulsepeaterTileEntity::new, AllBlocks.FLEXPULSEPEATER),
// Curiosities
WINDOW_IN_A_BLOCK(WindowInABlockTileEntity::new, AllBlocks.WINDOW_IN_A_BLOCK),
;
private Supplier<? extends TileEntity> supplier;

View file

@ -14,15 +14,15 @@ public class CTSpriteShifter extends SpriteShifter {
public static CTSpriteShiftEntry get(CTType type, String blockTextureName) {
return get(type, blockTextureName, blockTextureName);
}
public static CTSpriteShiftEntry get(CTType type, String blockTextureName, String connectedTextureName) {
return get(type, new ResourceLocation(Create.ID, "block/" + blockTextureName), connectedTextureName);
}
public static CTSpriteShiftEntry get(CTType type, ResourceLocation blockTexture, String connectedTextureName) {
String targetLocation = "block/connected/" + connectedTextureName;
String key = type.name() + ":" + blockTexture.getNamespace() + ":" + blockTexture.getPath() + "->" + targetLocation;
String targetLocation = "block/" + connectedTextureName + "_connected";
String key =
type.name() + ":" + blockTexture.getNamespace() + ":" + blockTexture.getPath() + "->" + targetLocation;
if (textures.containsKey(key))
return (CTSpriteShiftEntry) textures.get(key);

View file

@ -1,9 +1,6 @@
package com.simibubi.create.foundation.block.connected;
import com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.math.BlockPos;
@ -18,15 +15,6 @@ public class GlassPaneCTBehaviour extends StandardCTBehaviour {
@Override
public boolean connectsTo(BlockState state, BlockState other, ILightReader reader, BlockPos pos, BlockPos otherPos,
Direction face) {
TileEntity te = reader.getTileEntity(pos);
if (te instanceof WindowInABlockTileEntity)
state = ((WindowInABlockTileEntity) te).getWindowBlock();
TileEntity otherTE = reader.getTileEntity(otherPos);
if (otherTE instanceof WindowInABlockTileEntity)
other = ((WindowInABlockTileEntity) otherTE).getWindowBlock();
return state.getBlock() == other.getBlock();
}

View file

@ -4,21 +4,15 @@ import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Map.Entry;
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
import com.simibubi.create.foundation.utility.data.BlockStateGen;
import com.simibubi.create.modules.Sections;
import com.simibubi.create.modules.palettes.ConnectedGlassBlock;
import com.tterrag.registrate.AbstractRegistrate;
import com.tterrag.registrate.builders.Builder;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.entry.RegistryEntry;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.IForgeRegistryEntry;
@ -81,15 +75,4 @@ public class CreateRegistrateBase<C extends AbstractRegistrate<C>> extends Abstr
.orElse(Sections.UNASSIGNED);
}
// Specific patterns
public BlockEntry<ConnectedGlassBlock> framedGlass(String name, ConnectedTextureBehaviour behaviour) {
return createBlock(name, ConnectedGlassBlock::new).connectedTextures(behaviour)
.addLayer(() -> RenderType::getTranslucent)
.initialProperties(() -> Blocks.GLASS)
.blockstate((c, p) -> BlockStateGen.cubeAll(c, p, "palettes/", "framed_glass"))
.simpleItem()
.register();
}
}

View file

@ -1,86 +0,0 @@
package com.simibubi.create.modules.curiosities;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import com.simibubi.create.config.AllConfigs;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.IGrowable;
import net.minecraft.block.RotatedPillarBlock;
import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
public class CocoaLogBlock extends RotatedPillarBlock implements IGrowable {
public static IntegerProperty AGE = BlockStateProperties.AGE_0_2;
public CocoaLogBlock() {
super(Properties.from(Blocks.JUNGLE_LOG).tickRandomly());
}
@Override
public boolean canGrow(IBlockReader arg0, BlockPos arg1, BlockState state, boolean arg3) {
return true;
}
@Override
public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) {
if (!worldIn.isAreaLoaded(pos, 1))
return; // Forge: prevent loading unloaded chunks when checking neighbor's light
grow(worldIn, random, pos, state);
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(AGE);
super.fillStateContainer(builder);
}
@Override
public boolean canUseBonemeal(World arg0, Random arg1, BlockPos arg2, BlockState arg3) {
return true;
}
@Override
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
if (random.nextDouble() > AllConfigs.SERVER.curiosities.cocoaLogGrowthSpeed.get() / 100D)
return;
int age = state.get(AGE);
if (age < 2) {
world.setBlockState(pos, state.with(AGE, age + 1));
return;
}
List<Direction> shuffledDirections = Arrays.asList(Direction.values());
Collections.shuffle(shuffledDirections);
for (Direction facing : shuffledDirections) {
if (facing.getAxis().isVertical())
continue;
if (facing.getAxis() == state.get(AXIS))
continue;
if (!world.getBlockState(pos.offset(facing)).getMaterial().isReplaceable())
continue;
world.setBlockState(pos.offset(facing),
Blocks.COCOA.getDefaultState().with(BlockStateProperties.HORIZONTAL_FACING, facing.getOpposite())
.with(BlockStateProperties.AGE_0_2, 0));
break;
}
}
}

View file

@ -1,227 +0,0 @@
package com.simibubi.create.modules.curiosities.partialWindows;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.simibubi.create.foundation.block.IHaveCustomBlockModel;
import com.simibubi.create.foundation.block.ITE;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FourWayBlock;
import net.minecraft.block.PaneBlock;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.RayTraceContext.BlockMode;
import net.minecraft.util.math.RayTraceContext.FluidMode;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootContext.Builder;
import net.minecraft.world.storage.loot.LootParameters;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class WindowInABlockBlock extends PaneBlock
implements ITE<WindowInABlockTileEntity>, IHaveCustomBlockModel {
public WindowInABlockBlock() {
super(Properties.create(Material.ROCK));
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new WindowInABlockTileEntity();
}
@Override
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player,
boolean willHarvest, IFluidState fluid) {
if (player == null)
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
Vec3d start = player.getEyePosition(1);
Vec3d end = start.add(player.getLookVec().scale(player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue()));
BlockRayTraceResult target =
world.rayTraceBlocks(new RayTraceContext(start, end, BlockMode.OUTLINE, FluidMode.NONE, player));
if (target == null || target.getHitVec() == null)
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
try {
WindowInABlockTileEntity tileEntity = getTileEntity(world, pos);
BlockState windowBlock = tileEntity.getWindowBlock();
for (AxisAlignedBB bb : windowBlock.getShape(world, pos).toBoundingBoxList()) {
if (bb.grow(.1d).contains(target.getHitVec().subtract(new Vec3d(pos)))) {
windowBlock.getBlock().onBlockHarvested(world, pos, windowBlock, player);
Block.spawnDrops(windowBlock, world, pos, null, player, player.getHeldItemMainhand());
BlockState partialBlock = tileEntity.getPartialBlock();
world.setBlockState(pos, partialBlock);
for (Direction d : Direction.values()) {
BlockPos offset = pos.offset(d);
BlockState otherState = world.getBlockState(offset);
partialBlock = partialBlock.updatePostPlacement(d, otherState, world, pos, offset);
world.notifyBlockUpdate(offset, otherState, otherState, 2);
}
if (partialBlock != world.getBlockState(pos))
world.setBlockState(pos, partialBlock);
return false;
}
}
} catch (TileEntityException e) {}
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
}
// @Override // TODO 1.15 register layer
// public boolean canRenderInLayer(BlockState state, BlockRenderLayer layer) {
// return true;
// }
@Override
public boolean isReplaceable(BlockState state, BlockItemUseContext useContext) {
return false;
}
@Override
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
return getSurroundingBlockState(reader, pos).propagatesSkylightDown(reader, pos);
}
@Override
public boolean collisionExtendsVertically(BlockState state, IBlockReader world, BlockPos pos,
Entity collidingEntity) {
return getSurroundingBlockState(world, pos).collisionExtendsVertically(world, pos, collidingEntity);
}
@Override
public float getBlockHardness(BlockState blockState, IBlockReader worldIn, BlockPos pos) {
return getSurroundingBlockState(worldIn, pos).getBlockHardness(worldIn, pos);
}
@Override
public float getExplosionResistance(BlockState state, IWorldReader world, BlockPos pos, Entity exploder,
Explosion explosion) {
return getSurroundingBlockState(world, pos).getExplosionResistance(world, pos, exploder, explosion);
}
@Override
public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos,
PlayerEntity player) {
BlockState window = getWindowBlockState(world, pos);
for (AxisAlignedBB bb : window.getShape(world, pos).toBoundingBoxList()) {
if (bb.grow(.1d).contains(target.getHitVec().subtract(new Vec3d(pos))))
return window.getPickBlock(target, world, pos, player);
}
BlockState surrounding = getSurroundingBlockState(world, pos);
return surrounding.getPickBlock(target, world, pos, player);
}
@Override
public List<ItemStack> getDrops(BlockState state, Builder builder) {
TileEntity tileentity = builder.get(LootParameters.BLOCK_ENTITY);
if (!(tileentity instanceof WindowInABlockTileEntity))
return Collections.emptyList();
WindowInABlockTileEntity te = (WindowInABlockTileEntity) tileentity;
List<ItemStack> drops = te.getPartialBlock().getDrops(builder);
drops.addAll(te.getWindowBlock().getDrops(builder));
return drops;
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
VoxelShape shape1 = getSurroundingBlockState(worldIn, pos).getShape(worldIn, pos, context);
VoxelShape shape2 = getWindowBlockState(worldIn, pos).getShape(worldIn, pos, context);
return VoxelShapes.or(shape1, shape2);
}
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos,
ISelectionContext context) {
return getShape(state, worldIn, pos, context);
}
@SuppressWarnings("deprecation")
@Override
public MaterialColor getMaterialColor(BlockState state, IBlockReader worldIn, BlockPos pos) {
return getSurroundingBlockState(worldIn, pos).getMaterialColor(worldIn, pos);
}
@Override
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
BlockPos currentPos, BlockPos facingPos) {
withTileEntityDo(worldIn, currentPos, te -> {
te.setWindowBlock(
te.getWindowBlock().updatePostPlacement(facing, facingState, worldIn, currentPos, facingPos));
BlockState blockState =
te.getPartialBlock().updatePostPlacement(facing, facingState, worldIn, currentPos, facingPos);
if (blockState.getBlock() instanceof FourWayBlock) {
for (BooleanProperty side : Arrays.asList(FourWayBlock.EAST, FourWayBlock.NORTH, FourWayBlock.SOUTH,
FourWayBlock.WEST))
blockState = blockState.with(side, false);
te.setPartialBlock(blockState);
}
te.requestModelDataUpdate();
});
return stateIn;
}
private BlockState getSurroundingBlockState(IBlockReader reader, BlockPos pos) {
try {
return getTileEntity(reader, pos).getPartialBlock();
} catch (TileEntityException e) {}
return Blocks.AIR.getDefaultState();
}
private BlockState getWindowBlockState(IBlockReader reader, BlockPos pos) {
try {
return getTileEntity(reader, pos).getWindowBlock();
} catch (TileEntityException e) {}
return Blocks.AIR.getDefaultState();
}
@OnlyIn(Dist.CLIENT)
public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) {
return false;
}
@Override
@OnlyIn(Dist.CLIENT)
public IBakedModel createModel(IBakedModel original) {
return new WindowInABlockModel(original);
}
@Override
public Class<WindowInABlockTileEntity> getTileEntityClass() {
return WindowInABlockTileEntity.class;
}
}

View file

@ -1,118 +0,0 @@
package com.simibubi.create.modules.curiosities.partialWindows;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity.PARTIAL_BLOCK;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity.POSITION;
import static com.simibubi.create.modules.curiosities.partialWindows.WindowInABlockTileEntity.WINDOW_BLOCK;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import com.simibubi.create.foundation.block.render.WrappedBakedModel;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
public class WindowInABlockModel extends WrappedBakedModel {
public WindowInABlockModel(IBakedModel template) {
super(template);
}
@Override
public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) {
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
BlockState partialState = data.getData(PARTIAL_BLOCK);
BlockState windowState = data.getData(WINDOW_BLOCK);
BlockPos position = data.getData(POSITION);
ClientWorld world = Minecraft.getInstance().world;
List<BakedQuad> quads = new ArrayList<>();
if (partialState == null || windowState == null)
return dispatcher.getModelForState(Blocks.DIRT.getDefaultState()).getQuads(state, side, rand, data);
RenderType renderLayer = MinecraftForgeClient.getRenderLayer();
if (RenderTypeLookup.canRenderInLayer(partialState, renderLayer) && partialState != null) {
IBakedModel partialModel = dispatcher.getModelForState(partialState);
IModelData modelData = partialModel.getModelData(Minecraft.getInstance().world, position, partialState,
EmptyModelData.INSTANCE);
quads.addAll(partialModel.getQuads(partialState, side, rand, modelData));
}
if (RenderTypeLookup.canRenderInLayer(windowState, renderLayer) && windowState != null) {
IBakedModel windowModel = dispatcher.getModelForState(windowState);
IModelData modelData =
windowModel.getModelData(Minecraft.getInstance().world, position, windowState, EmptyModelData.INSTANCE);
quads.addAll(dispatcher.getModelForState(windowState).getQuads(windowState, side, rand, modelData).stream()
.filter(q -> {
Direction face = q.getFace();
if (face != null
&& world.getBlockState(position.offset(face)).isSideInvisible(windowState, face))
return false;
if (face != null && Block.hasSolidSide(partialState, world, position, face))
return false;
fightZfighting(q);
return true;
}).collect(Collectors.toList()));
}
return quads;
}
protected void fightZfighting(BakedQuad q) {
VertexFormat format = DefaultVertexFormats.BLOCK;
int[] data = q.getVertexData();
Vec3i vec = q.getFace().getDirectionVec();
int dirX = vec.getX();
int dirY = vec.getY();
int dirZ = vec.getZ();
for (int i = 0; i < 4; ++i) {
int j = format.getIntegerSize() * i;
float x = Float.intBitsToFloat(data[j + 0]);
float y = Float.intBitsToFloat(data[j + 1]);
float z = Float.intBitsToFloat(data[j + 2]);
double offset = q.getFace().getAxis().getCoordinate(x, y, z);
if (offset < 1 / 1024d || offset > 1023 / 1024d) {
data[j + 0] = Float.floatToIntBits(x - 1 / 512f * dirX);
data[j + 1] = Float.floatToIntBits(y - 1 / 512f * dirY);
data[j + 2] = Float.floatToIntBits(z - 1 / 512f * dirZ);
}
}
}
@Override
public TextureAtlasSprite getParticleTexture(IModelData data) {
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
BlockState partialState = data.getData(PARTIAL_BLOCK);
if (partialState == null)
return super.getParticleTexture(data);
return dispatcher.getModelForState(partialState).getParticleTexture(data);
}
@Override
public boolean isAmbientOcclusion() {
return MinecraftForgeClient.getRenderLayer() == RenderType.getSolid();
}
}

View file

@ -1,95 +0,0 @@
package com.simibubi.create.modules.curiosities.partialWindows;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.SyncedTileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.client.model.data.ModelDataMap;
import net.minecraftforge.client.model.data.ModelProperty;
import net.minecraftforge.fml.DistExecutor;
public class WindowInABlockTileEntity extends SyncedTileEntity {
private BlockState partialBlock = Blocks.AIR.getDefaultState();
private BlockState windowBlock = Blocks.AIR.getDefaultState();
@OnlyIn(value = Dist.CLIENT)
private IModelData modelData;
public static final ModelProperty<BlockState> PARTIAL_BLOCK = new ModelProperty<>();
public static final ModelProperty<BlockState> WINDOW_BLOCK = new ModelProperty<>();
public static final ModelProperty<BlockPos> POSITION = new ModelProperty<>();
public WindowInABlockTileEntity() {
super(AllTileEntities.WINDOW_IN_A_BLOCK.type);
DistExecutor.runWhenOn(Dist.CLIENT, () -> this::initDataMap);
}
@OnlyIn(value = Dist.CLIENT)
private void initDataMap() {
modelData = new ModelDataMap.Builder().withInitial(WINDOW_BLOCK, Blocks.AIR.getDefaultState())
.withInitial(PARTIAL_BLOCK, Blocks.AIR.getDefaultState()).withInitial(POSITION, BlockPos.ZERO).build();
}
@Override
public void read(CompoundNBT compound) {
partialBlock = NBTUtil.readBlockState(compound.getCompound("PartialBlock"));
windowBlock = NBTUtil.readBlockState(compound.getCompound("WindowBlock"));
super.read(compound);
}
@Override
public void readClientUpdate(CompoundNBT tag) {
super.readClientUpdate(tag);
}
@Override
public CompoundNBT write(CompoundNBT compound) {
compound.put("PartialBlock", NBTUtil.writeBlockState(getPartialBlock()));
compound.put("WindowBlock", NBTUtil.writeBlockState(getWindowBlock()));
return super.write(compound);
}
public void updateWindowConnections() {
for (Direction side : Direction.values()) {
BlockPos offsetPos = pos.offset(side);
windowBlock = getWindowBlock().updatePostPlacement(side, world.getBlockState(offsetPos), world, pos,
offsetPos);
}
world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 2 | 16);
markDirty();
}
@OnlyIn(value = Dist.CLIENT)
@Override
public IModelData getModelData() {
modelData.setData(PARTIAL_BLOCK, partialBlock);
modelData.setData(WINDOW_BLOCK, windowBlock);
modelData.setData(POSITION, pos);
return modelData;
}
public BlockState getPartialBlock() {
return partialBlock;
}
public void setPartialBlock(BlockState partialBlock) {
this.partialBlock = partialBlock;
}
public BlockState getWindowBlock() {
return windowBlock;
}
public void setWindowBlock(BlockState windowBlock) {
this.windowBlock = windowBlock;
}
}

View file

@ -1,84 +0,0 @@
package com.simibubi.create.modules.curiosities.partialWindows;
import java.util.Arrays;
import com.simibubi.create.AllBlockTags;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.config.AllConfigs;
import net.minecraft.block.BlockState;
import net.minecraft.block.FourWayBlock;
import net.minecraft.block.WallBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.Tags;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock;
import net.minecraftforge.eventbus.api.Event.Result;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
@EventBusSubscriber(bus = Bus.FORGE)
public class WindowLoggingHandler {
@SubscribeEvent
public static void rightClickPartialBlockWithPaneMakesItWindowLogged(RightClickBlock event) {
if (event.getUseItem() == Result.DENY)
return;
if (event.getEntityLiving().isSneaking())
return;
if (!event.getPlayer().isAllowEdit())
return;
if (!AllConfigs.SERVER.curiosities.allowGlassPanesInPartialBlocks.get())
return;
ItemStack stack = event.getItemStack();
if (stack.isEmpty())
return;
if (!(stack.getItem() instanceof BlockItem))
return;
BlockItem item = (BlockItem) stack.getItem();
if (!item.isIn(Tags.Items.GLASS_PANES)
&& (item.getBlock() == null || !item.getBlock().isIn(Tags.Blocks.GLASS_PANES)))
return;
BlockPos pos = event.getPos();
World world = event.getWorld();
BlockState blockState = world.getBlockState(pos);
if (!AllBlockTags.WINDOWABLE.matches(blockState))
return;
if (AllBlocks.WINDOW_IN_A_BLOCK.typeOf(blockState))
return;
BlockState defaultState = AllBlocks.WINDOW_IN_A_BLOCK.get().getDefaultState();
world.setBlockState(pos, defaultState);
TileEntity te = world.getTileEntity(pos);
if (te != null && te instanceof WindowInABlockTileEntity) {
WindowInABlockTileEntity wte = (WindowInABlockTileEntity) te;
wte.setWindowBlock(item.getBlock().getDefaultState());
wte.updateWindowConnections();
if (blockState.getBlock() instanceof FourWayBlock) {
for (BooleanProperty side : Arrays.asList(FourWayBlock.EAST, FourWayBlock.NORTH, FourWayBlock.SOUTH,
FourWayBlock.WEST))
blockState = blockState.with(side, false);
}
if (blockState.getBlock() instanceof WallBlock)
blockState = blockState.with(WallBlock.UP, true);
wte.setPartialBlock(blockState);
wte.requestModelDataUpdate();
if (!event.getPlayer().isCreative())
stack.shrink(1);
event.getPlayer().swingArm(event.getHand());
}
event.setCanceled(true);
}
}

View file

@ -13,6 +13,7 @@ import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.SandBlock;
import net.minecraft.client.renderer.RenderType;
public class AllPaletteBlocks {
@ -30,6 +31,16 @@ public class AllPaletteBlocks {
public static final BlockEntry<ConnectedGlassBlock> VERTICAL_FRAMED_GLASS =
REGISTRATE.framedGlass("vertical_framed_glass", new HorizontalCTBehaviour(AllCTs.VERTICAL_FRAMED_GLASS.get()));
public static final BlockEntry<WindowBlock> OAK_WINDOW = REGISTRATE.woodenWindowBlock("oak", AllCTs.OAK_WINDOW),
SPRUCE_WINDOW = REGISTRATE.woodenWindowBlock("spruce", AllCTs.SPRUCE_WINDOW),
BIRCH_WINDOW = REGISTRATE.woodenWindowBlock("birch", AllCTs.BIRCH_WINDOW, () -> RenderType::getTranslucent),
JUNGLE_WINDOW = REGISTRATE.woodenWindowBlock("jungle", AllCTs.JUNGLE_WINDOW),
ACACIA_WINDOW = REGISTRATE.woodenWindowBlock("acacia", AllCTs.ACACIA_WINDOW),
DARK_OAK_WINDOW = REGISTRATE.woodenWindowBlock("dark_oak", AllCTs.DARK_OAK_WINDOW);
public static final BlockEntry<WindowBlock> ORNATE_IRON_WINDOW =
REGISTRATE.customWindowBlock("ornate_iron_window", AllCTs.ORNATE_IRON_WINDOW, () -> RenderType::getCutoutMipped);
// Vanilla stone variant patterns
public static final PalettesVariantEntry GRANITE_VARIANTS = new PalettesVariantEntry("granite",
@ -95,6 +106,7 @@ public class AllPaletteBlocks {
REGISTRATE.createBlock("natural_scoria", ScoriaBlock::new)
.initialProperties(() -> Blocks.ANDESITE)
.blockstate(palettesCubeAll())
.simpleItem()
.register();
public static final BlockEntry<Block> SCORIA = REGISTRATE.baseBlock("scoria", Block::new, () -> Blocks.ANDESITE)

View file

@ -53,13 +53,13 @@ public class PaletteBlockPatterns {
.blockStateFactory(p -> p::cubeAllButMossy)
.block(MossyBlock::new)
.textures("bricks", "mossy")
.useCutoutLayer(),
.useTranslucentLayer(),
OVERGROWN = create("overgrown", Prefix)
.blockStateFactory(p -> p::cubeAllButMossy)
.block(MossyBlock::new)
.textures("bricks", "overgrown")
.useCutoutLayer()
.useTranslucentLayer()
;
@ -75,7 +75,7 @@ public class PaletteBlockPatterns {
private PatternNameType nameType;
private String[] textures;
private String id;
private boolean isCutout;
private boolean isTranslucent;
private IPatternBlockStateGenerator blockStateGenerator;
private NonNullFunction<Properties, ? extends Block> blockFactory;
@ -87,7 +87,7 @@ public class PaletteBlockPatterns {
PaletteBlockPatterns pattern = new PaletteBlockPatterns();
pattern.id = name;
pattern.nameType = nameType;
pattern.isCutout = false;
pattern.isTranslucent = false;
pattern.blockFactory = Block::new;
pattern.textures = new String[] { name };
pattern.blockStateGenerator = p -> p::cubeAll;
@ -98,8 +98,8 @@ public class PaletteBlockPatterns {
return blockStateGenerator;
}
public boolean isCutout() {
return isCutout;
public boolean isTranslucent() {
return isTranslucent;
}
public NonNullFunction<Properties, ? extends Block> getBlockFactory() {
@ -123,8 +123,8 @@ public class PaletteBlockPatterns {
return this;
}
private PaletteBlockPatterns useCutoutLayer() {
isCutout = true;
private PaletteBlockPatterns useTranslucentLayer() {
isTranslucent = true;
return this;
}

View file

@ -2,7 +2,6 @@ package com.simibubi.create.modules.palettes;
import java.util.Collection;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import com.simibubi.create.CreateItemGroupBase;
import com.tterrag.registrate.util.entry.RegistryEntry;
@ -19,17 +18,16 @@ public class PalettesItemGroup extends CreateItemGroupBase {
@Override
protected Collection<RegistryEntry<Block>> getBlocks() {
return Create.palettesRegistrate().getAll(Block.class);
return Create.palettesRegistrate()
.getAll(Block.class);
}
@Override
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {
}
public void addItems(NonNullList<ItemStack> items, boolean specialItems) {}
@Override
public ItemStack createIcon() {
return new ItemStack(AllBlocks.COPPER_BLOCK.get());
// return new ItemStack(AllBlocks.IRON_GLASS.get());
return new ItemStack(AllPaletteBlocks.ORNATE_IRON_WINDOW.get());
}
}

View file

@ -1,15 +1,25 @@
package com.simibubi.create.modules.palettes;
import java.util.function.Supplier;
import com.simibubi.create.AllCTs;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour;
import com.simibubi.create.foundation.registrate.CreateRegistrateBase;
import com.simibubi.create.foundation.utility.data.BlockStateGen;
import com.simibubi.create.modules.Sections;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.util.NonNullLazyValue;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import net.minecraft.block.Block;
import net.minecraft.block.Block.Properties;
import net.minecraft.block.Blocks;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.util.ResourceLocation;
public class PalettesRegistrate extends CreateRegistrateBase<PalettesRegistrate> {
@ -31,10 +41,56 @@ public class PalettesRegistrate extends CreateRegistrateBase<PalettesRegistrate>
})
.simpleItem();
}
@Override
public Sections currentSection() {
return Sections.PALETTES;
}
// Specific patterns
public BlockEntry<WindowBlock> woodenWindowBlock(String woodType, AllCTs ct) {
return woodenWindowBlock(woodType, ct, () -> RenderType::getCutoutMipped);
}
public BlockEntry<WindowBlock> customWindowBlock(String name, AllCTs ct,
Supplier<Supplier<RenderType>> renderType) {
NonNullFunction<String, ResourceLocation> end_texture =
n -> Create.asResource("block/palettes/" + name + "_end");
NonNullFunction<String, ResourceLocation> side_texture = n -> Create.asResource("block/palettes/" + n);
return windowBlock(name, ct, renderType, end_texture, side_texture);
}
public BlockEntry<WindowBlock> woodenWindowBlock(String woodType, AllCTs ct,
Supplier<Supplier<RenderType>> renderType) {
String name = woodType + "_window";
NonNullFunction<String, ResourceLocation> end_texture =
$ -> new ResourceLocation("block/" + woodType + "_planks");
NonNullFunction<String, ResourceLocation> side_texture = n -> Create.asResource("block/palettes/" + n);
return windowBlock(name, ct, renderType, end_texture, side_texture);
}
public BlockEntry<WindowBlock> windowBlock(String name, AllCTs ct, Supplier<Supplier<RenderType>> renderType,
NonNullFunction<String, ResourceLocation> endTexture, NonNullFunction<String, ResourceLocation> sideTexture) {
return createBlock(name, WindowBlock::new).connectedTextures(new HorizontalCTBehaviour(ct.get()))
.addLayer(renderType)
.initialProperties(() -> Blocks.GLASS)
.blockstate((c, p) -> p.simpleBlock(c.get(), p.models()
.cubeColumn(c.getName(), sideTexture.apply(c.getName()), endTexture.apply(c.getName()))))
.simpleItem()
.register();
}
public BlockEntry<ConnectedGlassBlock> framedGlass(String name, ConnectedTextureBehaviour behaviour) {
return createBlock(name, ConnectedGlassBlock::new).connectedTextures(behaviour)
.addLayer(() -> RenderType::getTranslucent)
.initialProperties(() -> Blocks.GLASS)
.blockstate((c, p) -> BlockStateGen.cubeAll(c, p, "palettes/", "framed_glass"))
.item()
.model((c, p) -> p.cubeColumn(c.getName(), p.modLoc("block/palettes/" + c.getName()),
p.modLoc("block/palettes/framed_glass")))
.build()
.register();
}
}

View file

@ -25,8 +25,8 @@ public class PalettesVariantEntry {
.apply(pattern)
.apply(name)::accept);
if (pattern.isCutout())
builder.addLayer(() -> RenderType::getCutoutMipped);
if (pattern.isTranslucent())
builder.addLayer(() -> RenderType::getTranslucent);
registeredBlocks.add(registerFunc.apply(builder));
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/acacia_glass" }
}
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/acacia/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/acacia/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/acacia/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/acacia/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/acacia/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/acacia/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/acacia/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/acacia/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/acacia/noside", "y": 270 }
}
]
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/birch_glass" }
}
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/birch/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/birch/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/birch/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/birch/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/birch/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/birch/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/birch/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/birch/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/birch/noside", "y": 270 }
}
]
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/dark_oak_glass" }
}
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/dark_oak/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/dark_oak/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/dark_oak/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/dark_oak/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/dark_oak/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/dark_oak/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/dark_oak/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/dark_oak/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/dark_oak/noside", "y": 270 }
}
]
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/glass/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/glass/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/glass/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/glass/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/glass/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/glass/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/glass/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/glass/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/glass/noside", "y": 270 }
}
]
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/indented_gabbro" }
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"type=top": { "model":"create:block/palettes/indented_gabbro_slab_top" },
"type=bottom": { "model":"create:block/palettes/indented_gabbro_slab" },
"type=double": { "model":"create:block/palettes/indented_gabbro" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/iron_glass" }
}
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/iron/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/iron/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/iron/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/iron/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/iron/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/iron/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/iron/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/iron/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/iron/noside", "y": 270 }
}
]
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/jungle_glass" }
}
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/jungle/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/jungle/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/jungle/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/jungle/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/jungle/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/jungle/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/jungle/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/jungle/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/jungle/noside", "y": 270 }
}
]
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/natural_scoria" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/oak_glass" }
}
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/oak/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/oak/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/oak/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/oak/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/oak/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/oak/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/oak/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/oak/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/oak/noside", "y": 270 }
}
]
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/paved_gabbro_bricks" }
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"type=top": { "model":"create:block/palettes/paved_gabbro_bricks_slab_top" },
"type=bottom": { "model":"create:block/palettes/paved_gabbro_bricks_slab" },
"type=double": { "model":"create:block/palettes/paved_gabbro_bricks" }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/palettes/spruce_glass" }
}
}

View file

@ -1,31 +0,0 @@
{
"multipart": [
{
"apply": { "model": "create:block/palettes/pane/spruce/post" }
},
{ "when": { "north": true },
"apply": { "model": "create:block/palettes/pane/spruce/side" }
},
{ "when": { "east": true },
"apply": { "model": "create:block/palettes/pane/spruce/side", "y": 90 }
},
{ "when": { "south": true },
"apply": { "model": "create:block/palettes/pane/spruce/side_alt" }
},
{ "when": { "west": true },
"apply": { "model": "create:block/palettes/pane/spruce/side_alt", "y": 90 }
},
{ "when": { "north": false },
"apply": { "model": "create:block/palettes/pane/spruce/noside" }
},
{ "when": { "east": false },
"apply": { "model": "create:block/palettes/pane/spruce/noside_alt" }
},
{ "when": { "south": false },
"apply": { "model": "create:block/palettes/pane/spruce/noside_alt", "y": 90 }
},
{ "when": { "west": false },
"apply": { "model": "create:block/palettes/pane/spruce/noside", "y": 270 }
}
]
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "block/acacia_planks",
"side": "create:block/acacia_window"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "block/birch_planks",
"side": "create:block/birch_window"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "block/dark_oak_planks",
"side": "create:block/dark_oak_window"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "create:block/iron_window_top",
"side": "create:block/iron_window"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "block/jungle_planks",
"side": "create:block/jungle_window"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "block/oak_planks",
"side": "create:block/oak_window"
}
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "block/spruce_log_top",
"side": "create:block/spruce_window"
}
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/acacia_glass"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/birch_glass"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/dark_oak_glass"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/framed_glass"
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "create:block/framed_glass",
"side": "create:block/horizontal_framed_glass"
}
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/iron_glass"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/jungle_glass"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/oak_glass"
}

View file

@ -1,3 +0,0 @@
{
"parent": "create:block/palettes/spruce_glass"
}

View file

@ -1,7 +0,0 @@
{
"parent": "block/cube_column",
"textures": {
"end": "create:block/framed_glass",
"side": "create:block/vertical_framed_glass"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

Some files were not shown because too many files have changed in this diff Show more