Sprites and CT
Swapping dev environment, this snapshot does not launch
|
@ -8,6 +8,7 @@ import com.simibubi.create.foundation.block.RenderUtilityAxisBlock;
|
|||
import com.simibubi.create.foundation.block.RenderUtilityBlock;
|
||||
import com.simibubi.create.foundation.block.RenderUtilityDirectionalBlock;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.world.CopperOreBlock;
|
||||
import com.simibubi.create.modules.IModule;
|
||||
import com.simibubi.create.modules.contraptions.components.actors.DrillBlock;
|
||||
import com.simibubi.create.modules.contraptions.components.actors.DrillBlock.DrillHeadBlock;
|
||||
|
@ -95,6 +96,10 @@ import net.minecraftforge.registries.IForgeRegistry;
|
|||
|
||||
public enum AllBlocks {
|
||||
|
||||
__MATERIALS__(),
|
||||
COPPER_ORE(new CopperOreBlock()),
|
||||
ZINC_ORE(new Block(Properties.from(Blocks.GOLD_ORE))),
|
||||
|
||||
__SCHEMATICS__(),
|
||||
SCHEMATICANNON(new SchematicannonBlock()),
|
||||
SCHEMATICANNON_CONNECTOR(new RenderUtilityBlock()),
|
||||
|
|
|
@ -67,6 +67,9 @@ public enum AllItems {
|
|||
CRUSHED_ZINC(ingredient()),
|
||||
CRUSHED_BRASS(ingredient()),
|
||||
|
||||
ELECTRON_TUBE(ingredient()),
|
||||
CIRCUIT(ingredient()),
|
||||
|
||||
// BLAZING_PICKAXE(new BlazingToolItem(1, -2.8F, standardProperties(), PICKAXE)),
|
||||
// BLAZING_SHOVEL(new BlazingToolItem(1.5F, -3.0F, standardProperties(), SHOVEL)),
|
||||
// BLAZING_AXE(new BlazingToolItem(5.0F, -3.0F, standardProperties(), AXE)),
|
||||
|
@ -104,7 +107,7 @@ public enum AllItems {
|
|||
CARDBOARD_BOX_1416(new CardboardBoxItem(standardItemProperties())),
|
||||
CARDBOARD_BOX_1410(new CardboardBoxItem(standardItemProperties())),
|
||||
|
||||
FILTER(new FilterItem(standardItemProperties())),
|
||||
FILTER(new FilterItem(standardItemProperties()), true),
|
||||
LOGISTICAL_DIAL(new LogisticalDialItem(standardItemProperties())),
|
||||
LOGISTICAL_CONTROLLER_SUPPLY(new LogisticalControllerItem(standardItemProperties(), Type.SUPPLY)),
|
||||
LOGISTICAL_CONTROLLER_REQUEST(new LogisticalControllerItem(standardItemProperties(), Type.REQUEST)),
|
||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.simibubi.create.foundation.block.CTModel;
|
||||
import com.simibubi.create.foundation.block.ColoredVertexModel;
|
||||
import com.simibubi.create.foundation.block.IHaveColoredVertices;
|
||||
import com.simibubi.create.foundation.block.IHaveConnectedTextures;
|
||||
import com.simibubi.create.foundation.block.SpriteShifter.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.connected.CTModel;
|
||||
import com.simibubi.create.foundation.block.connected.IHaveConnectedTextures;
|
||||
import com.simibubi.create.foundation.block.render.ColoredVertexModel;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBufferCache;
|
||||
import com.simibubi.create.modules.contraptions.WrenchModel;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
import com.simibubi.create.foundation.block.SpriteShifter;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
|
||||
import net.minecraft.client.resources.ReloadListener;
|
||||
import net.minecraft.profiler.IProfiler;
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
package com.simibubi.create.foundation.block;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SpriteShifter {
|
||||
|
||||
public static class SpriteShiftEntry {
|
||||
ResourceLocation originalTextureLocation;
|
||||
ResourceLocation targetTextureLocation;
|
||||
TextureAtlasSprite original;
|
||||
TextureAtlasSprite target;
|
||||
|
||||
void loadTextures() {
|
||||
AtlasTexture textureMap = Minecraft.getInstance().getTextureMap();
|
||||
original = textureMap.getSprite(originalTextureLocation);
|
||||
target = textureMap.getSprite(targetTextureLocation);
|
||||
}
|
||||
|
||||
public ResourceLocation getTargetResourceLocation() {
|
||||
return targetTextureLocation;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getTarget() {
|
||||
if (target == null)
|
||||
loadTextures();
|
||||
return target;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getOriginal() {
|
||||
if (original == null)
|
||||
loadTextures();
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
static Map<String, SpriteShiftEntry> textures = new HashMap<>();
|
||||
|
||||
public static SpriteShiftEntry getCT(String blockId) {
|
||||
return get("block/" + blockId, "block/connected/" + blockId);
|
||||
}
|
||||
|
||||
public static SpriteShiftEntry get(String originalLocation, String targetLocation) {
|
||||
String key = originalLocation + "->" + targetLocation;
|
||||
if (textures.containsKey(key))
|
||||
return textures.get(key);
|
||||
|
||||
SpriteShiftEntry entry = new SpriteShiftEntry();
|
||||
entry.originalTextureLocation = new ResourceLocation(Create.ID, originalLocation);
|
||||
entry.targetTextureLocation = new ResourceLocation(Create.ID, targetLocation);
|
||||
textures.put(key, entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
public static void reloadUVs() {
|
||||
textures.values().forEach(SpriteShiftEntry::loadTextures);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package com.simibubi.create.foundation.block;
|
||||
package com.simibubi.create.foundation.block.connected;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.foundation.block.SpriteShifter.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -93,8 +93,8 @@ public class CTModel extends BakedModelWrapper<IBakedModel> {
|
|||
float uShift = (index % 8) * textureSize;
|
||||
float vShift = (index / 8) * textureSize * 2;
|
||||
|
||||
uShift = texture.target.getInterpolatedU((index % 8) * 2) - texture.original.getMinU();
|
||||
vShift = texture.target.getInterpolatedV((index / 8) * 2) - texture.original.getMinV();
|
||||
uShift = texture.getTarget().getInterpolatedU((index % 8) * 2) - texture.getOriginal().getMinU();
|
||||
vShift = texture.getTarget().getInterpolatedV((index / 8) * 2) - texture.getOriginal().getMinV();
|
||||
|
||||
BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length),
|
||||
quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(),
|
|
@ -0,0 +1,112 @@
|
|||
package com.simibubi.create.foundation.block.connected;
|
||||
|
||||
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour.CTContext;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
|
||||
public abstract class CTSpriteShiftEntry extends SpriteShiftEntry {
|
||||
|
||||
int textureSheetSize;
|
||||
|
||||
public CTSpriteShiftEntry(int sheetSize) {
|
||||
this.textureSheetSize = sheetSize;
|
||||
}
|
||||
|
||||
public abstract int getTextureIndex(CTContext context);
|
||||
|
||||
public static class Horizontal extends CTSpriteShiftEntry {
|
||||
|
||||
public Horizontal() {
|
||||
super(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureIndex(CTContext context) {
|
||||
return (context.left ? 1 : 0) + (context.right ? 2 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Vertical extends CTSpriteShiftEntry {
|
||||
|
||||
public Vertical() {
|
||||
super(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureIndex(CTContext context) {
|
||||
return (context.up ? 1 : 0) + (context.down ? 2 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Omnidirectional extends CTSpriteShiftEntry {
|
||||
|
||||
public Omnidirectional() {
|
||||
super(8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextureIndex(CTContext context) {
|
||||
CTContext c = context;
|
||||
int tileX = 0, tileY = 0;
|
||||
int borders = (!c.up ? 1 : 0) + (!c.down ? 1 : 0) + (!c.left ? 1 : 0) + (!c.right ? 1 : 0);
|
||||
|
||||
if (c.up)
|
||||
tileX++;
|
||||
if (c.down)
|
||||
tileX += 2;
|
||||
if (c.left)
|
||||
tileY++;
|
||||
if (c.right)
|
||||
tileY += 2;
|
||||
|
||||
if (borders == 0) {
|
||||
if (c.topRight)
|
||||
tileX++;
|
||||
if (c.topLeft)
|
||||
tileX += 2;
|
||||
if (c.bottomRight)
|
||||
tileY += 2;
|
||||
if (c.bottomLeft)
|
||||
tileY++;
|
||||
}
|
||||
|
||||
if (borders == 1) {
|
||||
if (!c.right) {
|
||||
if (c.topLeft || c.bottomLeft) {
|
||||
tileY = 4;
|
||||
tileX = -1 + (c.bottomLeft ? 1 : 0) + (c.topLeft ? 1 : 0) * 2;
|
||||
}
|
||||
}
|
||||
if (!c.left) {
|
||||
if (c.topRight || c.bottomRight) {
|
||||
tileY = 5;
|
||||
tileX = -1 + (c.bottomRight ? 1 : 0) + (c.topRight ? 1 : 0) * 2;
|
||||
}
|
||||
}
|
||||
if (!c.down) {
|
||||
if (c.topLeft || c.topRight) {
|
||||
tileY = 6;
|
||||
tileX = -1 + (c.topLeft ? 1 : 0) + (c.topRight ? 1 : 0) * 2;
|
||||
}
|
||||
}
|
||||
if (!c.up) {
|
||||
if (c.bottomLeft || c.bottomRight) {
|
||||
tileY = 7;
|
||||
tileX = -1 + (c.bottomLeft ? 1 : 0) + (c.bottomRight ? 1 : 0) * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (borders == 2) {
|
||||
if ((c.up && c.left && c.topLeft) || (c.down && c.left && c.bottomLeft)
|
||||
|| (c.up && c.right && c.topRight) || (c.down && c.right && c.bottomRight))
|
||||
tileX += 3;
|
||||
}
|
||||
|
||||
return tileX + 8 * tileY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.simibubi.create.foundation.block.connected;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CTSpriteShifter extends SpriteShifter {
|
||||
|
||||
public enum CTType {
|
||||
OMNIDIRECTIONAL, HORIZONTAL, VERTICAL;
|
||||
}
|
||||
|
||||
public static CTSpriteShiftEntry get(CTType type, String blockTextureName, String connectedTextureName) {
|
||||
String originalLocation = "block/" + blockTextureName;
|
||||
String targetLocation = "block/connected/" + blockTextureName;
|
||||
String key = originalLocation + "->" + targetLocation;
|
||||
if (textures.containsKey(key))
|
||||
return (CTSpriteShiftEntry) textures.get(key);
|
||||
|
||||
CTSpriteShiftEntry entry = create(type);
|
||||
ResourceLocation originalTextureLocation = new ResourceLocation(Create.ID, originalLocation);
|
||||
ResourceLocation targetTextureLocation = new ResourceLocation(Create.ID, targetLocation);
|
||||
entry.set(originalTextureLocation, targetTextureLocation);
|
||||
|
||||
textures.put(key, entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
private static CTSpriteShiftEntry create(CTType type) {
|
||||
switch (type) {
|
||||
case HORIZONTAL:
|
||||
return new CTSpriteShiftEntry.Horizontal();
|
||||
case OMNIDIRECTIONAL:
|
||||
return new CTSpriteShiftEntry.Omnidirectional();
|
||||
case VERTICAL:
|
||||
return new CTSpriteShiftEntry.Vertical();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.simibubi.create.foundation.block.connected;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.BiPredicate;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class ConnectedTextureBehaviour {
|
||||
|
||||
class CTContext {
|
||||
boolean up, down, left, right;
|
||||
boolean topLeft, topRight, bottomLeft, bottomRight;
|
||||
}
|
||||
|
||||
public abstract CTSpriteShiftEntry get(BlockState state, Direction direction);
|
||||
|
||||
boolean shouldFlipUVs(BlockState state, Direction face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean connectsTo(BlockState state, BlockState other, IEnviromentBlockReader reader, BlockPos pos,
|
||||
BlockPos otherPos, Direction face) {
|
||||
|
||||
BlockPos blockingPos = otherPos.offset(face);
|
||||
if ((face.getAxis().getCoordinate(pos.getX(), pos.getY(), pos.getZ()) == face.getAxis()
|
||||
.getCoordinate(otherPos.getX(), otherPos.getY(), otherPos.getZ()))
|
||||
&& connectsTo(state, reader.getBlockState(blockingPos), reader, pos, blockingPos, face))
|
||||
return false;
|
||||
|
||||
return state.getBlock() == other.getBlock();
|
||||
}
|
||||
|
||||
CTContext buildContext(IEnviromentBlockReader reader, BlockPos pos, BlockState state, Direction face) {
|
||||
Axis axis = face.getAxis();
|
||||
boolean positive = face.getAxisDirection() == AxisDirection.POSITIVE;
|
||||
Direction h = axis == Axis.X ? Direction.SOUTH : Direction.WEST;
|
||||
Direction v = axis.isHorizontal() ? Direction.UP : Direction.NORTH;
|
||||
h = positive ? h.getOpposite() : h;
|
||||
if (face == Direction.DOWN) {
|
||||
v = v.getOpposite();
|
||||
h = h.getOpposite();
|
||||
}
|
||||
|
||||
final Direction horizontal = h;
|
||||
final Direction vertical = v;
|
||||
|
||||
BiPredicate<Integer, Integer> connection = (x, y) -> {
|
||||
BlockPos p = pos.offset(horizontal, x).offset(vertical, y);
|
||||
return connectsTo(state, reader.getBlockState(p), reader, pos, p, face);
|
||||
};
|
||||
|
||||
boolean up = connection.test(0, 1);
|
||||
boolean down = connection.test(0, -1);
|
||||
boolean left = connection.test(-1, 0);
|
||||
boolean right = connection.test(1, 0);
|
||||
boolean topLeft = connection.test(-1, 1);
|
||||
boolean topRight = connection.test(1, 1);
|
||||
boolean bottomLeft = connection.test(-1, -1);
|
||||
boolean bottomRight = connection.test(1, -1);
|
||||
|
||||
boolean flip = shouldFlipUVs(state, face);
|
||||
CTContext context = new CTContext();
|
||||
|
||||
context.up = flip ? down : up;
|
||||
context.down = flip ? up : down;
|
||||
context.left = flip ? right : left;
|
||||
context.right = flip ? left : right;
|
||||
context.topLeft = flip ? bottomRight : topLeft;
|
||||
context.topRight = flip ? bottomLeft : topRight;
|
||||
context.bottomLeft = flip ? topRight : bottomLeft;
|
||||
context.bottomRight = flip ? topLeft : bottomRight;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
package com.simibubi.create.foundation.block;
|
||||
package com.simibubi.create.foundation.block.connected;
|
||||
|
||||
import java.util.function.BiPredicate;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.foundation.block.SpriteShifter.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
|
@ -0,0 +1,7 @@
|
|||
package com.simibubi.create.foundation.block.connected;
|
||||
|
||||
public class StandardCTBehaviour extends ConnectedTextureBehaviour {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.block;
|
||||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
|
@ -1,10 +1,12 @@
|
|||
package com.simibubi.create.foundation.block;
|
||||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.foundation.block.IHaveColoredVertices;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.block;
|
||||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SpriteShiftEntry {
|
||||
protected ResourceLocation originalTextureLocation;
|
||||
protected ResourceLocation targetTextureLocation;
|
||||
protected TextureAtlasSprite original;
|
||||
protected TextureAtlasSprite target;
|
||||
|
||||
public void set(ResourceLocation originalTextureLocation, ResourceLocation targetTextureLocation) {
|
||||
this.originalTextureLocation = originalTextureLocation;
|
||||
this.targetTextureLocation = targetTextureLocation;
|
||||
}
|
||||
|
||||
protected void loadTextures() {
|
||||
AtlasTexture textureMap = Minecraft.getInstance().getTextureMap();
|
||||
original = textureMap.getSprite(originalTextureLocation);
|
||||
target = textureMap.getSprite(targetTextureLocation);
|
||||
}
|
||||
|
||||
public ResourceLocation getTargetResourceLocation() {
|
||||
return targetTextureLocation;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getTarget() {
|
||||
if (target == null)
|
||||
loadTextures();
|
||||
return target;
|
||||
}
|
||||
|
||||
public TextureAtlasSprite getOriginal() {
|
||||
if (original == null)
|
||||
loadTextures();
|
||||
return original;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SpriteShifter {
|
||||
|
||||
protected static Map<String, SpriteShiftEntry> textures = new HashMap<>();
|
||||
|
||||
public static SpriteShiftEntry get(String originalLocation, String targetLocation) {
|
||||
String key = originalLocation + "->" + targetLocation;
|
||||
if (textures.containsKey(key))
|
||||
return textures.get(key);
|
||||
|
||||
SpriteShiftEntry entry = new SpriteShiftEntry();
|
||||
entry.originalTextureLocation = new ResourceLocation(Create.ID, originalLocation);
|
||||
entry.targetTextureLocation = new ResourceLocation(Create.ID, targetLocation);
|
||||
textures.put(key, entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
public static void reloadUVs() {
|
||||
textures.values().forEach(SpriteShiftEntry::loadTextures);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.block;
|
||||
package com.simibubi.create.foundation.block.render;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
|
@ -0,0 +1,11 @@
|
|||
package com.simibubi.create.foundation.world;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
|
||||
public class CopperOreBlock extends OxidizingBlock {
|
||||
|
||||
public CopperOreBlock() {
|
||||
super(Properties.from(Blocks.IRON_ORE), 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.simibubi.create.foundation.world;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer.Builder;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class OxidizingBlock extends Block {
|
||||
|
||||
public static final BooleanProperty OXIDIZED = BooleanProperty.create("oxidized");
|
||||
private float chance;
|
||||
|
||||
public OxidizingBlock(Properties properties, float chance) {
|
||||
super(properties);
|
||||
this.chance = chance;
|
||||
setDefaultState(getDefaultState().with(OXIDIZED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder.add(OXIDIZED));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ticksRandomly(BlockState state) {
|
||||
return super.ticksRandomly(state) || !state.get(OXIDIZED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) {
|
||||
if (worldIn.getRandom().nextFloat() <= chance)
|
||||
for (Direction facing : Direction.values()) {
|
||||
BlockPos neighbourPos = pos.offset(facing);
|
||||
if (!worldIn.isBlockPresent(neighbourPos))
|
||||
continue;
|
||||
if (!Block.hasSolidSide(worldIn.getBlockState(neighbourPos), worldIn, neighbourPos,
|
||||
facing.getOpposite()))
|
||||
continue;
|
||||
worldIn.setBlockState(pos, state.with(OXIDIZED, true));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.modules.contraptions;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.block.CustomRenderItemBakedModel;
|
||||
import com.simibubi.create.foundation.block.render.CustomRenderItemBakedModel;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.simibubi.create.modules.contraptions.components.contraptions.chassis
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.block.IHaveConnectedTextures;
|
||||
import com.simibubi.create.foundation.block.SpriteShifter;
|
||||
import com.simibubi.create.foundation.block.SpriteShifter.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.connected.IHaveConnectedTextures;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
|
|
@ -7,8 +7,8 @@ import java.util.Random;
|
|||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.foundation.block.SpriteShifter;
|
||||
import com.simibubi.create.foundation.block.SpriteShifter.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.IndependentShadowRenderer;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.modules.curiosities.deforester;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.block.CustomRenderItemBakedModel;
|
||||
import com.simibubi.create.foundation.block.render.CustomRenderItemBakedModel;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.simibubi.create.foundation.block.WrappedBakedModel;
|
||||
import com.simibubi.create.foundation.block.render.WrappedBakedModel;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
|
|
@ -7,7 +7,7 @@ import javax.vecmath.Matrix4f;
|
|||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.simibubi.create.foundation.block.CustomRenderItemBakedModel;
|
||||
import com.simibubi.create.foundation.block.render.CustomRenderItemBakedModel;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.modules.curiosities.symmetry.client;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.block.CustomRenderItemBakedModel;
|
||||
import com.simibubi.create.foundation.block.render.CustomRenderItemBakedModel;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.modules.logistics.block.diodes;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.block.ColoredOverlayTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.block.render.ColoredOverlayTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
|
|
@ -1,24 +1,9 @@
|
|||
package com.simibubi.create.modules.logistics.item;
|
||||
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FilterItem extends Item {
|
||||
|
||||
public static class Color implements IItemColor {
|
||||
@Override
|
||||
public int getColor(ItemStack stack, int layer) {
|
||||
if (layer == 0)
|
||||
return 0xFFFFFF;
|
||||
if (layer == 1)
|
||||
return 0x6677AA;
|
||||
if (layer == 2)
|
||||
return 0x334477;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public FilterItem(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import static com.simibubi.create.modules.logistics.management.base.LogisticalCo
|
|||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.block.ColoredOverlayTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.block.render.ColoredOverlayTileEntityRenderer;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.modules.logistics.transport.villager;
|
|||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.block.ColoredOverlayTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.block.render.ColoredOverlayTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.modules.palettes;
|
||||
|
||||
import com.simibubi.create.foundation.block.IHaveConnectedTextures;
|
||||
import com.simibubi.create.foundation.block.connected.IHaveConnectedTextures;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.GlassBlock;
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"variants": {
|
||||
"oxidized=true": { "model": "create:block/copper_ore_oxidized" },
|
||||
"oxidized=false": { "model": "create:block/copper_ore" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"": { "model": "create:block/zinc_ore" }
|
||||
}
|
||||
}
|
|
@ -40,6 +40,9 @@
|
|||
"item.create.copper_nugget": "Copper Nugget",
|
||||
"item.create.crushed_copper": "Crushed Copper",
|
||||
|
||||
"item.create.electron_tube": "Electron Tube",
|
||||
"item.create.circuit": "Integrated Circuit",
|
||||
|
||||
"item.create.logistical_controller_supply": "Item Supply",
|
||||
"item.create.logistical_controller_request": "Item Request",
|
||||
"item.create.logistical_controller_storage": "Item Storage",
|
||||
|
@ -61,6 +64,9 @@
|
|||
"item.create.rose_quartz_axe": "Gilded Quartz Axe",
|
||||
"item.create.rose_quartz_sword": "Gilded Quartz Blade",
|
||||
|
||||
"block.create.copper_ore": "Copper Ore",
|
||||
"block.create.zinc_ore": "Zinc Ore",
|
||||
|
||||
"block.create.cogwheel": "Cogwheel",
|
||||
"block.create.large_cogwheel": "Large Cogwheel",
|
||||
"block.create.turntable": "Turntable",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "create:block/copper_ore"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "create:block/copper_ore_oxidized"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"textures": {
|
||||
"all": "create:block/zinc_ore"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/circuit"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "create:block/copper_ore"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/electron_tube"
|
||||
}
|
||||
}
|
|
@ -1,8 +1,108 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/filter",
|
||||
"layer1": "create:item/filter_1",
|
||||
"layer2": "create:item/filter_2"
|
||||
}
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"textures": {
|
||||
"0": "create:block/net",
|
||||
"1": "create:block/brass_casing",
|
||||
"2": "create:block/clutch_off",
|
||||
"particle": "create:block/net"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"name": "siderim",
|
||||
"from": [13, 0, 3],
|
||||
"to": [15, 2, 13],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 6, 2, 8], "texture": "#1"},
|
||||
"east": {"uv": [3, 0, 13, 2], "texture": "#1"},
|
||||
"south": {"uv": [14, 6, 16, 8], "texture": "#1"},
|
||||
"west": {"uv": [3, 0, 13, 2], "texture": "#1"},
|
||||
"up": {"uv": [0, 3, 2, 13], "rotation": 180, "texture": "#1"},
|
||||
"down": {"uv": [14, 3, 16, 13], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "siderim",
|
||||
"from": [1, 0, 3],
|
||||
"to": [3, 2, 13],
|
||||
"faces": {
|
||||
"north": {"uv": [2, 6, 0, 8], "texture": "#1"},
|
||||
"east": {"uv": [13, 0, 3, 2], "texture": "#1"},
|
||||
"south": {"uv": [16, 6, 14, 8], "texture": "#1"},
|
||||
"west": {"uv": [13, 0, 3, 2], "texture": "#1"},
|
||||
"up": {"uv": [2, 3, 0, 13], "rotation": 180, "texture": "#1"},
|
||||
"down": {"uv": [16, 3, 14, 13], "texture": "#1"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "net",
|
||||
"from": [3, 1, 4],
|
||||
"to": [13, 1.1, 12],
|
||||
"faces": {
|
||||
"up": {"uv": [3.5, 4.5, 13.5, 12.5], "texture": "#0"},
|
||||
"down": {"uv": [3.5, 4.5, 13.5, 12.5], "texture": "#0"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "toprim",
|
||||
"from": [3, 0.5, 3],
|
||||
"to": [13, 1.5, 4],
|
||||
"faces": {
|
||||
"north": {"uv": [2, 7, 12, 8], "texture": "#2"},
|
||||
"east": {"uv": [0, 0, 1, 1], "texture": "#missing"},
|
||||
"south": {"uv": [3, 7, 13, 8], "texture": "#2"},
|
||||
"west": {"uv": [0, 0, 1, 1], "texture": "#missing"},
|
||||
"up": {"uv": [3, 7, 13, 8], "texture": "#2"},
|
||||
"down": {"uv": [3, 7, 13, 8], "texture": "#2"}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "toprim",
|
||||
"from": [3, 0.5, 12],
|
||||
"to": [13, 1.5, 13],
|
||||
"faces": {
|
||||
"north": {"uv": [13, 7, 3, 8], "texture": "#2"},
|
||||
"east": {"uv": [1, 0, 0, 1], "texture": "#missing"},
|
||||
"south": {"uv": [14, 7, 4, 8], "texture": "#2"},
|
||||
"west": {"uv": [1, 0, 0, 1], "texture": "#missing"},
|
||||
"up": {"uv": [3, 8, 13, 7], "texture": "#2"},
|
||||
"down": {"uv": [3, 8, 13, 7], "texture": "#2"}
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [75, -180, 0],
|
||||
"translation": [-2.75, 3.25, 3.25],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [75, -180, 0],
|
||||
"translation": [-2.75, 3.25, 3.25],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [75, -180, 0],
|
||||
"translation": [-2.75, 3.25, 3.25],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [75, -180, 0],
|
||||
"translation": [-2.75, 3.25, 3.25],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"ground": {
|
||||
"translation": [0, 0.75, 0],
|
||||
"scale": [0.5, 0.5, 0.5]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [30, 225, 0],
|
||||
"translation": [0, 4.25, 0],
|
||||
"scale": [0.75, 0.75, 0.75]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [90, -180, 0],
|
||||
"translation": [0, 0, 6.5]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/microchip"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "create:block/zinc_ore"
|
||||
}
|
BIN
src/main/resources/assets/create/textures/block/copper_ore.png
Normal file
After Width: | Height: | Size: 809 B |
After Width: | Height: | Size: 823 B |
BIN
src/main/resources/assets/create/textures/block/zinc_ore.png
Normal file
After Width: | Height: | Size: 813 B |
BIN
src/main/resources/assets/create/textures/item/circuit.png
Normal file
After Width: | Height: | Size: 504 B |
BIN
src/main/resources/assets/create/textures/item/electron_tube.png
Normal file
After Width: | Height: | Size: 543 B |
After Width: | Height: | Size: 560 B |
After Width: | Height: | Size: 604 B |