Smelty on the Belty
- Encased Fans can smelt items - Added some random textures for future items - Moved some event calls - More Renames
|
@ -20,7 +20,7 @@ archivesBaseName = 'create'
|
|||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'snapshot', version: '20190825-1.14.3'
|
||||
mappings channel: 'snapshot', version: '20190902-1.14.3'
|
||||
|
||||
runs {
|
||||
client {
|
||||
|
@ -58,7 +58,7 @@ minecraft {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.minecraftforge:forge:1.14.4-28.0.55'
|
||||
minecraft 'net.minecraftforge:forge:1.14.4-28.0.83'
|
||||
}
|
||||
|
||||
jar {
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
import com.simibubi.create.foundation.item.IItemWithColorHandler;
|
||||
import com.simibubi.create.modules.contraptions.relays.belt.BeltItem;
|
||||
import com.simibubi.create.modules.curiosities.ChromaticCompoundCubeItem;
|
||||
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItem;
|
||||
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunItemRenderer;
|
||||
import com.simibubi.create.modules.curiosities.placementHandgun.BuilderGunModel;
|
||||
import com.simibubi.create.modules.gardens.TreeFertilizerItem;
|
||||
import com.simibubi.create.modules.logistics.item.FilterItem;
|
||||
import com.simibubi.create.modules.schematics.item.BlueprintAndQuillItem;
|
||||
import com.simibubi.create.modules.schematics.item.BlueprintItem;
|
||||
import com.simibubi.create.modules.schematics.item.SchematicAndQuillItem;
|
||||
import com.simibubi.create.modules.schematics.item.SchematicItem;
|
||||
import com.simibubi.create.modules.symmetry.SymmetryWandItem;
|
||||
import com.simibubi.create.modules.symmetry.client.SymmetryWandItemRenderer;
|
||||
import com.simibubi.create.modules.symmetry.client.SymmetryWandModel;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
||||
|
@ -33,21 +35,26 @@ public enum AllItems {
|
|||
|
||||
SYMMETRY_WAND(new SymmetryWandItem(
|
||||
standardProperties().setTEISR(() -> () -> renderUsing(AllItemRenderers.SYMMETRY_WAND)))),
|
||||
|
||||
|
||||
PLACEMENT_HANDGUN(
|
||||
new BuilderGunItem(new Properties().setTEISR(() -> () -> renderUsing(AllItemRenderers.BUILDER_GUN)))),
|
||||
|
||||
ANDESITE_ALLOY_CUBE(new Item(standardProperties())),
|
||||
BLAZE_BRASS_CUBE(new Item(standardProperties())),
|
||||
CHORUS_CHROME_CUBE(new Item(standardProperties().rarity(Rarity.UNCOMMON))),
|
||||
CHROMATIC_COMPOUND_CUBE(new ChromaticCompoundCubeItem(standardProperties().rarity(Rarity.UNCOMMON))),
|
||||
SHADOW_STEEL_CUBE(new Item(standardProperties().rarity(Rarity.UNCOMMON))),
|
||||
|
||||
BLAZING_PICKAXE(new Item(standardProperties())),
|
||||
BLAZING_SHOVEL(new Item(standardProperties())),
|
||||
BLAZING_AXE(new Item(standardProperties())),
|
||||
BLAZING_SWORD(new Item(standardProperties())),
|
||||
|
||||
TREE_FERTILIZER(new TreeFertilizerItem(standardProperties())),
|
||||
|
||||
|
||||
EMPTY_BLUEPRINT(new Item(standardProperties().maxStackSize(1))),
|
||||
BLUEPRINT_AND_QUILL(new BlueprintAndQuillItem(standardProperties().maxStackSize(1))),
|
||||
BLUEPRINT(new BlueprintItem(standardProperties())),
|
||||
BELT_CONNECTOR(new BeltItem(standardProperties())),
|
||||
FILTER(new FilterItem(standardProperties())),
|
||||
BLUEPRINT_AND_QUILL(new SchematicAndQuillItem(standardProperties().maxStackSize(1))),
|
||||
BLUEPRINT(new SchematicItem(standardProperties())), BELT_CONNECTOR(new BeltItem(standardProperties())),
|
||||
|
||||
;
|
||||
|
||||
|
@ -86,13 +93,18 @@ public enum AllItems {
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static void registerColorHandlers() {
|
||||
Minecraft.getInstance().getItemColors().register(new FilterItem.Color(), FILTER.item);
|
||||
ItemColors itemColors = Minecraft.getInstance().getItemColors();
|
||||
for (AllItems item : values()) {
|
||||
if (item.item instanceof IItemWithColorHandler) {
|
||||
itemColors.register(((IItemWithColorHandler) item.item).getColorHandler(), item.item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static ItemStackTileEntityRenderer renderUsing(AllItemRenderers renderer) {
|
||||
switch (renderer) {
|
||||
|
||||
|
||||
case SYMMETRY_WAND:
|
||||
return new SymmetryWandItemRenderer();
|
||||
case BUILDER_GUN:
|
||||
|
|
|
@ -6,12 +6,12 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltItemHandler;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.MouseScrollEvent;
|
||||
import net.minecraftforge.client.event.InputEvent.KeyInputEvent;
|
||||
import net.minecraftforge.client.event.InputEvent.MouseInputEvent;
|
||||
import net.minecraftforge.client.event.InputEvent.MouseScrollEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.event.TickEvent.ClientTickEvent;
|
||||
import net.minecraftforge.event.TickEvent.Phase;
|
||||
import net.minecraftforge.event.TickEvent.RenderTickEvent;
|
||||
|
@ -67,13 +67,12 @@ public class ClientEvents {
|
|||
CreateClient.schematicHandler.onKeyInput(key, pressed);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
// TODO: This is a fabricated event call by ScrollFixer until a proper event
|
||||
// exists
|
||||
public static void onMouseScrolled(MouseScrollEvent.Post event) {
|
||||
if (event.getGui() != null)
|
||||
public static void onMouseScrolled(MouseScrollEvent event) {
|
||||
if (Minecraft.getInstance().currentScreen != null)
|
||||
return;
|
||||
|
||||
|
||||
double delta = event.getScrollDelta();
|
||||
|
||||
boolean cancelled = CreateClient.schematicHandler.mouseScrolled(delta)
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.simibubi.create;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.simibubi.create.modules.logistics.FrequencyHandler;
|
||||
import com.simibubi.create.modules.logistics.InWorldItemProcessingHandler;
|
||||
import com.simibubi.create.modules.schematics.ServerSchematicLoader;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -27,10 +29,15 @@ public class Create {
|
|||
public static Logger logger = LogManager.getLogger();
|
||||
public static ItemGroup creativeTab = new CreateItemGroup();
|
||||
public static ServerSchematicLoader schematicReceiver;
|
||||
public static FrequencyHandler frequencyHandler;
|
||||
public static InWorldItemProcessingHandler itemProcessingHandler;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void init(final FMLCommonSetupEvent event) {
|
||||
schematicReceiver = new ServerSchematicLoader();
|
||||
itemProcessingHandler = new InWorldItemProcessingHandler();
|
||||
frequencyHandler = new FrequencyHandler();
|
||||
|
||||
AllPackets.registerPackets();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@ public class CreateClient {
|
|||
schematicSender = new ClientSchematicLoader();
|
||||
schematicHandler = new SchematicHandler();
|
||||
schematicHologram = new SchematicHologram();
|
||||
|
||||
ScrollFixer.init();
|
||||
schematicAndQuillHandler = new SchematicAndQuillHandler();
|
||||
|
||||
AllKeys.register();
|
||||
AllContainers.registerScreenFactories();
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraftforge.event.TickEvent.Phase;
|
||||
import net.minecraftforge.event.TickEvent.ServerTickEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
||||
|
@ -22,5 +24,19 @@ public class Events {
|
|||
Create.shutdown();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLoadWorld(WorldEvent.Load event) {
|
||||
IWorld world = event.getWorld();
|
||||
Create.itemProcessingHandler.onLoadWorld(world);
|
||||
Create.frequencyHandler.onLoadWorld(world);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onUnloadWorld(WorldEvent.Unload event) {
|
||||
IWorld world = event.getWorld();
|
||||
Create.itemProcessingHandler.onUnloadWorld(world);
|
||||
Create.frequencyHandler.onUnloadWorld(world);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWScrollCallback;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHelper;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.MouseScrollEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
public class ScrollFixer {
|
||||
|
||||
public static void init() {
|
||||
try {
|
||||
MouseHelper mouseHelper = Minecraft.getInstance().mouseHelper;
|
||||
Method method = ObfuscationReflectionHelper.findMethod(mouseHelper.getClass(), "func_198020_a", Long.TYPE,
|
||||
Double.TYPE, Double.TYPE);
|
||||
|
||||
GLFWScrollCallback callback = new GLFWScrollCallback() {
|
||||
@Override
|
||||
public void invoke(long win, double dx, double dy) {
|
||||
MouseScrollEvent.Post event = new MouseScrollEvent.Post(null, mouseHelper.getMouseX(),
|
||||
mouseHelper.getMouseY(), dy);
|
||||
boolean canceled = MinecraftForge.EVENT_BUS.post(event);
|
||||
if (canceled)
|
||||
return;
|
||||
|
||||
try {
|
||||
method.invoke(mouseHelper, win, dx, dy);
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
GLFW.glfwSetScrollCallback(Minecraft.getInstance().mainWindow.getHandle(), callback);
|
||||
} catch (SecurityException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.simibubi.create.foundation.item;
|
||||
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
|
||||
public interface IItemWithColorHandler {
|
||||
|
||||
public IItemColor getColorHandler();
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
public class ColorHelper {
|
||||
|
||||
public static int rainbowColor(int timeStep) {
|
||||
int localTimeStep = timeStep % 1536;
|
||||
int timeStepInPhase = localTimeStep % 256;
|
||||
int phaseBlue = localTimeStep / 256;
|
||||
int red = colorInPhase(phaseBlue + 4, timeStepInPhase);
|
||||
int green = colorInPhase(phaseBlue + 2, timeStepInPhase);
|
||||
int blue = colorInPhase(phaseBlue, timeStepInPhase);
|
||||
return (red << 16) + (green << 8) + (blue);
|
||||
}
|
||||
|
||||
private static int colorInPhase(int phase, int progress) {
|
||||
phase = phase % 6;
|
||||
if (phase <= 1)
|
||||
return 0;
|
||||
if (phase == 2)
|
||||
return progress;
|
||||
if (phase <= 4)
|
||||
return 255;
|
||||
else
|
||||
return 255 - progress;
|
||||
}
|
||||
|
||||
public static int mixColors(int color1, int color2, float w) {
|
||||
int r1 = (color1 >> 16);
|
||||
int g1 = (color1 >> 8) & 0xFF;
|
||||
int b1 = color1 & 0xFF;
|
||||
int r2 = (color2 >> 16);
|
||||
int g2 = (color2 >> 8) & 0xFF;
|
||||
int b2 = color2 & 0xFF;
|
||||
|
||||
int color = ((int) (r1 + (r2 - r1) * w) << 16)
|
||||
+ ((int) (g1 + (g2 - g1) * w) << 8)
|
||||
+ (int) (b1 + (b2 - b1) * w);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
}
|
|
@ -9,8 +9,6 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
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.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
@ -30,29 +28,17 @@ public class EncasedFanBlock extends EncasedShaftBlock implements IWithTileEntit
|
|||
|
||||
@Override
|
||||
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
Axis axisIn = state.get(AXIS);
|
||||
notifyFanTile(worldIn, pos, Direction.getFacingFromAxisDirection(axisIn, AxisDirection.POSITIVE));
|
||||
notifyFanTile(worldIn, pos, Direction.getFacingFromAxisDirection(axisIn, AxisDirection.NEGATIVE));
|
||||
notifyFanTile(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||
boolean isMoving) {
|
||||
Axis axisIn = state.get(AXIS);
|
||||
notifyFanTile(worldIn, pos, Direction.getFacingFromAxisDirection(axisIn, AxisDirection.POSITIVE));
|
||||
notifyFanTile(worldIn, pos, Direction.getFacingFromAxisDirection(axisIn, AxisDirection.NEGATIVE));
|
||||
notifyFanTile(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn,
|
||||
BlockPos currentPos, BlockPos facingPos) {
|
||||
if (facing.getAxis() == stateIn.get(AXIS))
|
||||
notifyFanTile(worldIn, currentPos, facing);
|
||||
return stateIn;
|
||||
}
|
||||
|
||||
protected void notifyFanTile(IWorld world, BlockPos pos, Direction facing) {
|
||||
withTileEntityDo(world, pos, te -> te.setNeighbour(facing, world.getBlockState(pos.offset(facing))));
|
||||
protected void notifyFanTile(IWorld world, BlockPos pos) {
|
||||
withTileEntityDo(world, pos, EncasedFanTileEntity::updateFrontBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,16 +14,17 @@ import java.util.UUID;
|
|||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.modules.logistics.InWorldProcessing;
|
||||
import com.simibubi.create.modules.logistics.InWorldProcessing.Type;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
|
@ -35,7 +36,6 @@ import net.minecraft.particles.RedstoneParticleData;
|
|||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -61,7 +61,6 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
.setFireDamage();
|
||||
|
||||
protected BlockState frontBlock;
|
||||
protected BlockState backBlock;
|
||||
protected float pushDistance;
|
||||
protected float pullDistance;
|
||||
protected float pushForce;
|
||||
|
@ -70,30 +69,36 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
protected AxisAlignedBB backBB;
|
||||
protected int blockCheckCooldown;
|
||||
protected boolean findLoadedItems;
|
||||
protected boolean findFrontBlock;
|
||||
public List<ProcessedItem> items;
|
||||
|
||||
public class ProcessedItem {
|
||||
private UUID loadedUUID;
|
||||
private int loadedTime;
|
||||
private ItemEntity entity;
|
||||
private int processingTimeLeft;
|
||||
|
||||
public ProcessedItem(UUID uuid, int timeLeft) {
|
||||
loadedUUID = uuid;
|
||||
processingTimeLeft = timeLeft;
|
||||
loadedTime = timeLeft;
|
||||
}
|
||||
|
||||
public ProcessedItem(ItemEntity item) {
|
||||
entity = item;
|
||||
processingTimeLeft = 100;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
world.addParticle(new RedstoneParticleData(1, 0, 1, 1), entity.posX, entity.posY, entity.posZ, 0, 0, 0);
|
||||
processingTimeLeft--;
|
||||
|
||||
if (processingTimeLeft <= 0) {
|
||||
entity.setItem(new ItemStack(Items.COAL));
|
||||
if (world.rand.nextInt(4) == 0) {
|
||||
Type processingType = getProcessingType();
|
||||
if (processingType == Type.BLASTING)
|
||||
world.addParticle(ParticleTypes.LARGE_SMOKE, entity.posX, entity.posY + .25f, entity.posZ, 0, 1/16f, 0);
|
||||
if (processingType == Type.SMOKING)
|
||||
world.addParticle(ParticleTypes.CLOUD, entity.posX, entity.posY + .25f, entity.posZ, 0, 1/16f, 0);
|
||||
}
|
||||
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
||||
Create.itemProcessingHandler.getProcessing(entity).process(entity);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -147,7 +152,8 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
|
||||
public EncasedFanTileEntity() {
|
||||
super(AllTileEntities.ENCASED_FAN.type);
|
||||
blockCheckCooldown = BLOCK_CHECK_UPDATE_DELAY;
|
||||
blockCheckCooldown = -1;
|
||||
findFrontBlock = true;
|
||||
frontBB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
backBB = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
items = new ArrayList<>();
|
||||
|
@ -185,32 +191,25 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
@Override
|
||||
public void readClientUpdate(CompoundNBT tag) {
|
||||
super.readClientUpdate(tag);
|
||||
pushDistance = tag.getFloat("PushDistance");
|
||||
pullDistance = tag.getFloat("PullDistance");
|
||||
pushForce = tag.getFloat("PushForce");
|
||||
pullForce = tag.getFloat("PullForce");
|
||||
updateBothNeighbours();
|
||||
updateFrontBlock();
|
||||
updateBBs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToClient(CompoundNBT tag) {
|
||||
super.writeToClient(tag);
|
||||
tag.putFloat("PushDistance", pushDistance);
|
||||
tag.putFloat("PullDistance", pullDistance);
|
||||
tag.putFloat("PushForce", pushForce);
|
||||
tag.putFloat("PullForce", pullForce);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
blockCheckCooldown = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(CompoundNBT compound) {
|
||||
super.read(compound);
|
||||
|
||||
pushDistance = compound.getFloat("PushDistance");
|
||||
pullDistance = compound.getFloat("PullDistance");
|
||||
pushForce = compound.getFloat("PushForce");
|
||||
pullForce = compound.getFloat("PullForce");
|
||||
|
||||
ListNBT itemsNBT = compound.getList("Items", 10);
|
||||
items.clear();
|
||||
for (INBT iNBT : itemsNBT) {
|
||||
|
@ -222,11 +221,16 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT compound) {
|
||||
compound.putFloat("PushDistance", pushDistance);
|
||||
compound.putFloat("PullDistance", pullDistance);
|
||||
compound.putFloat("PushForce", pushForce);
|
||||
compound.putFloat("PullForce", pullForce);
|
||||
|
||||
ListNBT itemsNBT = new ListNBT();
|
||||
for (ProcessedItem item : items) {
|
||||
CompoundNBT itemNBT = new CompoundNBT();
|
||||
itemNBT.put("UUID", NBTUtil.writeUniqueId(item.entity.getUniqueID()));
|
||||
itemNBT.putInt("TimeLeft", item.processingTimeLeft);
|
||||
itemNBT.putInt("TimeLeft", Create.itemProcessingHandler.getProcessing(item.entity).timeRemaining);
|
||||
itemsNBT.add(itemNBT);
|
||||
}
|
||||
compound.put("Items", itemsNBT);
|
||||
|
@ -287,23 +291,15 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
.grow(.25f);
|
||||
}
|
||||
|
||||
public void updateBothNeighbours() {
|
||||
Axis axis = getBlockState().get(AXIS);
|
||||
Direction frontFacing = Direction.getFacingFromAxis(POSITIVE, axis);
|
||||
Direction backFacing = Direction.getFacingFromAxis(NEGATIVE, axis);
|
||||
BlockPos front = pos.offset(frontFacing);
|
||||
BlockPos back = pos.offset(backFacing);
|
||||
public void updateFrontBlock() {
|
||||
Direction facing = getAirFlow();
|
||||
if (facing == null) {
|
||||
frontBlock = Blocks.AIR.getDefaultState();
|
||||
return;
|
||||
}
|
||||
BlockPos front = pos.offset(facing);
|
||||
if (world.isBlockPresent(front))
|
||||
setNeighbour(frontFacing, world.getBlockState(front));
|
||||
if (world.isBlockPresent(back))
|
||||
setNeighbour(backFacing, world.getBlockState(back));
|
||||
}
|
||||
|
||||
public void setNeighbour(Direction direction, BlockState neighbourState) {
|
||||
if (direction.getAxisDirection() == NEGATIVE)
|
||||
backBlock = neighbourState;
|
||||
else
|
||||
frontBlock = neighbourState;
|
||||
frontBlock = world.getBlockState(front);
|
||||
updateReachAndForce();
|
||||
}
|
||||
|
||||
|
@ -316,6 +312,7 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
@Override
|
||||
public void onSpeedChanged() {
|
||||
updateReachAndForce();
|
||||
updateFrontBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -335,59 +332,124 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
entity.setFire(10);
|
||||
entity.attackEntityFrom(damageSourceLava, 8);
|
||||
}
|
||||
} else {
|
||||
boolean missing = true;
|
||||
for (ProcessedItem processed : items) {
|
||||
if (processed.entity == entity) {
|
||||
processed.tick();
|
||||
missing = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (missing) {
|
||||
items.add(new ProcessedItem((ItemEntity) entity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, backBB)) {
|
||||
moveEntity(entity, false);
|
||||
}
|
||||
|
||||
if (findFrontBlock) {
|
||||
findFrontBlock = false;
|
||||
updateFrontBlock();
|
||||
}
|
||||
|
||||
if (!world.isRemote && blockCheckCooldown-- <= 0) {
|
||||
blockCheckCooldown = BLOCK_CHECK_UPDATE_DELAY;
|
||||
updateReachAndForce();
|
||||
}
|
||||
|
||||
updateProcessedItems(frontEntities);
|
||||
|
||||
if (world.isRemote) {
|
||||
makeParticles();
|
||||
return;
|
||||
}
|
||||
|
||||
if (blockCheckCooldown-- <= 0) {
|
||||
blockCheckCooldown = BLOCK_CHECK_UPDATE_DELAY;
|
||||
updateReachAndForce();
|
||||
discoverEntitiesAfterLoad(frontEntities);
|
||||
}
|
||||
|
||||
public void updateProcessedItems(List<Entity> frontEntities) {
|
||||
ArrayList<ProcessedItem> prevItems = new ArrayList<>(items);
|
||||
Iterator<ProcessedItem> itemIter = prevItems.iterator();
|
||||
|
||||
if (canProcess()) {
|
||||
while (itemIter.hasNext()) {
|
||||
Iterator<Entity> entityIter = frontEntities.iterator();
|
||||
ProcessedItem item = itemIter.next();
|
||||
|
||||
while (entityIter.hasNext()) {
|
||||
Entity e = entityIter.next();
|
||||
if (!(e instanceof ItemEntity)) {
|
||||
entityIter.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.entity == e && e.isAlive()) {
|
||||
item.tick();
|
||||
entityIter.remove();
|
||||
itemIter.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add remaining
|
||||
for (Entity entity : frontEntities) {
|
||||
if (entity instanceof ItemEntity && canProcess((ItemEntity) entity)) {
|
||||
items.add(new ProcessedItem((ItemEntity) entity));
|
||||
if (!world.isRemote)
|
||||
Create.itemProcessingHandler.startProcessing((ItemEntity) entity,
|
||||
new InWorldProcessing(getProcessingType(), 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ProcessedItem lostItem : prevItems) {
|
||||
items.remove(lostItem);
|
||||
if (!world.isRemote && lostItem.entity != null)
|
||||
Create.itemProcessingHandler.stopProcessing(lostItem.entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void discoverEntitiesAfterLoad(List<Entity> frontEntities) {
|
||||
if (findLoadedItems) {
|
||||
findLoadedItems = false;
|
||||
Iterator<ProcessedItem> iterator = items.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ProcessedItem item = iterator.next();
|
||||
if (!canProcess())
|
||||
iterator.remove();
|
||||
|
||||
for (Entity entity : frontEntities) {
|
||||
if (!(entity instanceof ItemEntity))
|
||||
continue;
|
||||
if (entity.getUniqueID().equals(item.loadedUUID))
|
||||
if (entity.getUniqueID().equals(item.loadedUUID)) {
|
||||
item.entity = (ItemEntity) entity;
|
||||
if (!world.isRemote && canProcess((ItemEntity) entity))
|
||||
Create.itemProcessingHandler.startProcessing((ItemEntity) entity,
|
||||
new InWorldProcessing(getProcessingType(), item.loadedTime));
|
||||
}
|
||||
}
|
||||
if (item.entity == null)
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<ProcessedItem> iterator = items.iterator();
|
||||
while (iterator.hasNext())
|
||||
if (!iterator.next().entity.getBoundingBox().intersects(frontBB))
|
||||
iterator.remove();
|
||||
protected boolean canProcess() {
|
||||
return getProcessingType() != null;
|
||||
}
|
||||
|
||||
protected boolean canProcess(ItemEntity entity) {
|
||||
return canProcess() && new InWorldProcessing(getProcessingType(), 0).canProcess(entity);
|
||||
}
|
||||
|
||||
protected InWorldProcessing.Type getProcessingType() {
|
||||
Block block = frontBlock.getBlock();
|
||||
|
||||
if (block == Blocks.FIRE)
|
||||
return Type.SMOKING;
|
||||
if (block == Blocks.WATER)
|
||||
return Type.SPLASHING;
|
||||
if (block == Blocks.LAVA)
|
||||
return Type.BLASTING;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void moveEntity(Entity entity, boolean push) {
|
||||
if ((entity instanceof ItemEntity) && AllBlocks.BELT.typeOf(world.getBlockState(entity.getPosition()))) {
|
||||
if ((entity instanceof ItemEntity) && AllBlocks.BELT.typeOf(world.getBlockState(entity.getPosition()))
|
||||
&& getAirFlow() != Direction.UP) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -416,13 +478,6 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
|
|||
fx.render(directionVec, true, this);
|
||||
}
|
||||
}
|
||||
if (backBlock != null && !hasFx) {
|
||||
if (effects.containsKey(backBlock.getBlock())) {
|
||||
hasFx = true;
|
||||
for (FanEffect fx : effects.get(backBlock.getBlock()))
|
||||
fx.render(directionVec, true, this);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasFx)
|
||||
for (FanEffect fx : effects.get(Blocks.AIR))
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.simibubi.create.modules.curiosities;
|
||||
|
||||
import com.simibubi.create.foundation.item.IItemWithColorHandler;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.client.model.animation.Animation;
|
||||
|
||||
public class ChromaticCompoundCubeItem extends Item implements IItemWithColorHandler {
|
||||
|
||||
public static class Color implements IItemColor {
|
||||
@Override
|
||||
public int getColor(ItemStack stack, int layer) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
float pt = mc.getRenderPartialTicks();
|
||||
float progress = (float) ((mc.player.getYaw(pt)) / 180 * Math.PI)
|
||||
+ (Animation.getWorldTime(mc.world, pt) * 1f);
|
||||
if (layer == 0)
|
||||
return ColorHelper.mixColors(0xDDDDDD, 0xDDDDDD, ((float) MathHelper.sin(progress) + 1) / 2);
|
||||
if (layer == 1)
|
||||
return ColorHelper.mixColors(0x72A498, 0xB9D6FF,
|
||||
((float) MathHelper.sin((float) (progress + Math.PI)) + 1) / 2);
|
||||
if (layer == 2)
|
||||
return ColorHelper.mixColors(0x5082CE, 0x91C5B7,
|
||||
((float) MathHelper.sin((float) (progress * 1.5f + Math.PI)) + 1) / 2);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public ChromaticCompoundCubeItem(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemColor getColorHandler() {
|
||||
return new Color();
|
||||
}
|
||||
|
||||
}
|
|
@ -13,11 +13,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber
|
||||
public class FrequencyHandler {
|
||||
|
||||
public static final int RANGE = 128;
|
||||
|
@ -53,23 +49,21 @@ public class FrequencyHandler {
|
|||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLoadWorld(WorldEvent.Load event) {
|
||||
connections.put(event.getWorld(), new HashMap<>());
|
||||
Create.logger.info("Prepared network space for " + event.getWorld().getDimension().getType().getRegistryName());
|
||||
public void onLoadWorld(IWorld world) {
|
||||
connections.put(world, new HashMap<>());
|
||||
Create.logger.info("Prepared network space for " + world.getDimension().getType().getRegistryName());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onUnloadWorld(WorldEvent.Unload event) {
|
||||
connections.remove(event.getWorld());
|
||||
Create.logger.info("Removed network space for " + event.getWorld().getDimension().getType().getRegistryName());
|
||||
public void onUnloadWorld(IWorld world) {
|
||||
connections.remove(world);
|
||||
Create.logger.info("Removed network space for " + world.getDimension().getType().getRegistryName());
|
||||
}
|
||||
|
||||
private static Pair<Frequency, Frequency> getNetworkKey(IHaveWireless actor) {
|
||||
return Pair.of(actor.getFrequencyFirst(), actor.getFrequencyLast());
|
||||
}
|
||||
|
||||
public static List<IHaveWireless> getNetworkOf(IHaveWireless actor) {
|
||||
public List<IHaveWireless> getNetworkOf(IHaveWireless actor) {
|
||||
Map<Pair<Frequency, Frequency>, List<IHaveWireless>> networksInWorld = networksIn(actor.getWorld());
|
||||
Pair<Frequency, Frequency> key = getNetworkKey(actor);
|
||||
if (!networksInWorld.containsKey(key))
|
||||
|
@ -77,12 +71,12 @@ public class FrequencyHandler {
|
|||
return networksInWorld.get(key);
|
||||
}
|
||||
|
||||
public static void addToNetwork(IHaveWireless actor) {
|
||||
public void addToNetwork(IHaveWireless actor) {
|
||||
getNetworkOf(actor).add(actor);
|
||||
updateNetworkOf(actor);
|
||||
}
|
||||
|
||||
public static void removeFromNetwork(IHaveWireless actor) {
|
||||
public void removeFromNetwork(IHaveWireless actor) {
|
||||
List<IHaveWireless> network = getNetworkOf(actor);
|
||||
network.remove(actor);
|
||||
if (network.isEmpty()) {
|
||||
|
@ -92,7 +86,7 @@ public class FrequencyHandler {
|
|||
updateNetworkOf(actor);
|
||||
}
|
||||
|
||||
public static void updateNetworkOf(IHaveWireless actor) {
|
||||
public void updateNetworkOf(IHaveWireless actor) {
|
||||
List<IHaveWireless> network = getNetworkOf(actor);
|
||||
boolean powered = false;
|
||||
|
||||
|
@ -119,7 +113,7 @@ public class FrequencyHandler {
|
|||
return from.getPos().withinDistance(to.getPos(), RANGE);
|
||||
}
|
||||
|
||||
public static Map<Pair<Frequency, Frequency>, List<IHaveWireless>> networksIn(IWorld world) {
|
||||
public Map<Pair<Frequency, Frequency>, List<IHaveWireless>> networksIn(IWorld world) {
|
||||
if (!connections.containsKey(world)) {
|
||||
Create.logger.warn(
|
||||
"Tried to Access unprepared network space of " + world.getDimension().getType().getRegistryName());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simibubi.create.modules.logistics;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.modules.logistics.FrequencyHandler.Frequency;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -17,5 +18,8 @@ public interface IHaveWireless {
|
|||
public default boolean isLoaded() {
|
||||
return getWorld().isBlockPresent(getPos());
|
||||
}
|
||||
default FrequencyHandler getHandler() {
|
||||
return Create.frequencyHandler;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package com.simibubi.create.modules.logistics;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
public interface ITransmitWireless extends IHaveWireless {
|
||||
|
||||
public boolean getSignal();
|
||||
public default void notifySignalChange() {
|
||||
FrequencyHandler.updateNetworkOf(this);
|
||||
Create.frequencyHandler.updateNetworkOf(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.simibubi.create.modules.logistics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.world.IWorld;
|
||||
|
||||
public class InWorldItemProcessingHandler {
|
||||
|
||||
private Map<IWorld, Map<ItemEntity, InWorldProcessing>> items = new HashMap<>();
|
||||
|
||||
public void onLoadWorld(IWorld world) {
|
||||
items.put(world, new HashMap<>());
|
||||
Create.logger.info("Prepared Item Processing space for " + world.getDimension().getType().getRegistryName());
|
||||
}
|
||||
|
||||
public void onUnloadWorld(IWorld world) {
|
||||
items.remove(world);
|
||||
Create.logger.info("Removed Item Processing space for " + world.getDimension().getType().getRegistryName());
|
||||
}
|
||||
|
||||
public void startProcessing(ItemEntity entity, InWorldProcessing processing) {
|
||||
Map<ItemEntity, InWorldProcessing> itemsInWorld = items.get(entity.world);
|
||||
if (itemsInWorld.containsKey(entity) && processing.type == itemsInWorld.get(entity).type) {
|
||||
itemsInWorld.get(entity).processorCount++;
|
||||
} else {
|
||||
itemsInWorld.put(entity, processing);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopProcessing(ItemEntity entity) {
|
||||
Map<ItemEntity, InWorldProcessing> itemsInWorld = items.get(entity.world);
|
||||
if (!itemsInWorld.containsKey(entity))
|
||||
return;
|
||||
InWorldProcessing processing = itemsInWorld.get(entity);
|
||||
processing.processorCount--;
|
||||
|
||||
if (processing.processorCount == 0)
|
||||
itemsInWorld.remove(entity);
|
||||
}
|
||||
|
||||
public InWorldProcessing getProcessing(ItemEntity entity) {
|
||||
Map<ItemEntity, InWorldProcessing> itemsInWorld = items.get(entity.world);
|
||||
if (!itemsInWorld.containsKey(entity))
|
||||
return null;
|
||||
return itemsInWorld.get(entity);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package com.simibubi.create.modules.logistics;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.BlastingRecipe;
|
||||
import net.minecraft.item.crafting.FurnaceRecipe;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeType;
|
||||
import net.minecraft.item.crafting.SmokingRecipe;
|
||||
import net.minecraft.tileentity.BlastFurnaceTileEntity;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
import net.minecraft.tileentity.SmokerTileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class InWorldProcessing {
|
||||
|
||||
public enum Type {
|
||||
SMOKING, BLASTING, SPLASHING
|
||||
}
|
||||
|
||||
public Type type;
|
||||
public int processorCount;
|
||||
public int timeRemaining;
|
||||
|
||||
public InWorldProcessing(Type type, int time) {
|
||||
this.timeRemaining = time;
|
||||
this.type = type;
|
||||
processorCount = 1;
|
||||
}
|
||||
|
||||
public boolean canProcess(ItemEntity entity) {
|
||||
World world = entity.world;
|
||||
|
||||
if (type == Type.BLASTING) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type == Type.SMOKING) {
|
||||
SmokerTileEntity smoker = new SmokerTileEntity();
|
||||
smoker.setWorld(world);
|
||||
smoker.setInventorySlotContents(0, entity.getItem());
|
||||
Optional<SmokingRecipe> recipe = world.getRecipeManager().getRecipe(IRecipeType.SMOKING, smoker, world);
|
||||
return recipe.isPresent();
|
||||
}
|
||||
|
||||
if (type == Type.SPLASHING) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void process(ItemEntity entity) {
|
||||
timeRemaining--;
|
||||
if (timeRemaining != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = entity.world;
|
||||
|
||||
if (type == Type.SPLASHING) {
|
||||
return;
|
||||
}
|
||||
|
||||
SmokerTileEntity smoker = new SmokerTileEntity();
|
||||
smoker.setWorld(world);
|
||||
smoker.setInventorySlotContents(0, entity.getItem());
|
||||
Optional<SmokingRecipe> smokingRecipe = world.getRecipeManager().getRecipe(IRecipeType.SMOKING, smoker, world);
|
||||
|
||||
if (type == Type.BLASTING) {
|
||||
FurnaceTileEntity furnace = new FurnaceTileEntity();
|
||||
furnace.setWorld(world);
|
||||
furnace.setInventorySlotContents(0, entity.getItem());
|
||||
Optional<FurnaceRecipe> smeltingRecipe = world.getRecipeManager().getRecipe(IRecipeType.SMELTING, furnace,
|
||||
world);
|
||||
|
||||
if (!smokingRecipe.isPresent()) {
|
||||
if (smeltingRecipe.isPresent()) {
|
||||
applyRecipeOn(entity, smeltingRecipe.get());
|
||||
return;
|
||||
}
|
||||
|
||||
BlastFurnaceTileEntity blastFurnace = new BlastFurnaceTileEntity();
|
||||
blastFurnace.setWorld(world);
|
||||
blastFurnace.setInventorySlotContents(0, entity.getItem());
|
||||
Optional<BlastingRecipe> blastingRecipe = world.getRecipeManager().getRecipe(IRecipeType.BLASTING,
|
||||
blastFurnace, world);
|
||||
|
||||
if (blastingRecipe.isPresent()) {
|
||||
applyRecipeOn(entity, blastingRecipe.get());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
entity.setItem(new ItemStack(Items.GUNPOWDER, entity.getItem().getCount()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == Type.SMOKING && smokingRecipe.isPresent()) {
|
||||
applyRecipeOn(entity, smokingRecipe.get());
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void applyRecipeOn(ItemEntity entity, IRecipe<?> recipe) {
|
||||
ItemStack out = recipe.getRecipeOutput().copy();
|
||||
out.setCount(entity.getItem().getCount());
|
||||
entity.setItem(out);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.simibubi.create.modules.logistics.block;
|
||||
|
||||
import com.simibubi.create.foundation.block.SyncedTileEntity;
|
||||
import com.simibubi.create.modules.logistics.FrequencyHandler;
|
||||
import com.simibubi.create.modules.logistics.FrequencyHandler.Frequency;
|
||||
import com.simibubi.create.modules.logistics.IHaveWireless;
|
||||
|
||||
|
@ -13,19 +12,19 @@ public abstract class LinkedTileEntity extends SyncedTileEntity implements IHave
|
|||
|
||||
public Frequency frequencyFirst;
|
||||
public Frequency frequencyLast;
|
||||
|
||||
|
||||
public LinkedTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
frequencyFirst = new Frequency(ItemStack.EMPTY);
|
||||
frequencyLast = new Frequency(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
super.onLoad();
|
||||
if (world.isRemote)
|
||||
return;
|
||||
FrequencyHandler.addToNetwork(this);
|
||||
getHandler().addToNetwork(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,9 +32,9 @@ public abstract class LinkedTileEntity extends SyncedTileEntity implements IHave
|
|||
super.remove();
|
||||
if (world.isRemote)
|
||||
return;
|
||||
FrequencyHandler.removeFromNetwork(this);
|
||||
getHandler().removeFromNetwork(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT compound) {
|
||||
compound.put("FrequencyFirst", frequencyFirst.getStack().write(new CompoundNBT()));
|
||||
|
@ -49,7 +48,7 @@ public abstract class LinkedTileEntity extends SyncedTileEntity implements IHave
|
|||
frequencyLast = new Frequency(ItemStack.read(compound.getCompound("FrequencyLast")));
|
||||
super.read(compound);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setFrequency(boolean first, ItemStack stack) {
|
||||
stack = stack.copy();
|
||||
|
@ -59,7 +58,7 @@ public abstract class LinkedTileEntity extends SyncedTileEntity implements IHave
|
|||
|| !ItemStack.areItemStackTagsEqual(stack, toCompare);
|
||||
|
||||
if (changed)
|
||||
FrequencyHandler.removeFromNetwork(this);
|
||||
getHandler().removeFromNetwork(this);
|
||||
|
||||
if (first)
|
||||
frequencyFirst = new Frequency(stack);
|
||||
|
@ -70,14 +69,14 @@ public abstract class LinkedTileEntity extends SyncedTileEntity implements IHave
|
|||
return;
|
||||
|
||||
sendData();
|
||||
FrequencyHandler.addToNetwork(this);
|
||||
getHandler().addToNetwork(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Frequency getFrequencyFirst() {
|
||||
return frequencyFirst;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Frequency getFrequencyLast() {
|
||||
return frequencyLast;
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.simibubi.create.Create;
|
|||
import com.simibubi.create.foundation.type.DimensionPos;
|
||||
import com.simibubi.create.foundation.utility.FilesHelper;
|
||||
import com.simibubi.create.modules.schematics.block.SchematicTableTileEntity;
|
||||
import com.simibubi.create.modules.schematics.item.BlueprintItem;
|
||||
import com.simibubi.create.modules.schematics.item.SchematicItem;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
|
@ -226,7 +226,7 @@ public class ServerSchematicLoader {
|
|||
tileEntity.finishUpload();
|
||||
tileEntity.inventory.setStackInSlot(0, ItemStack.EMPTY);
|
||||
tileEntity.inventory.setStackInSlot(1,
|
||||
BlueprintItem.create(schematic, player.getName().getFormattedText()));
|
||||
SchematicItem.create(schematic, player.getName().getFormattedText()));
|
||||
|
||||
} catch (IOException e) {
|
||||
Create.logger.error("Exception Thrown when finishing Upload: " + playerSchematicId);
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.simibubi.create.foundation.block.SyncedTileEntity;
|
|||
import com.simibubi.create.foundation.type.Cuboid;
|
||||
import com.simibubi.create.modules.schematics.MaterialChecklist;
|
||||
import com.simibubi.create.modules.schematics.SchematicWorld;
|
||||
import com.simibubi.create.modules.schematics.item.BlueprintItem;
|
||||
import com.simibubi.create.modules.schematics.item.SchematicItem;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
@ -515,7 +515,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
|
|||
}
|
||||
|
||||
// Load blocks into reader
|
||||
Template activeTemplate = BlueprintItem.getSchematic(blueprint);
|
||||
Template activeTemplate = SchematicItem.getSchematic(blueprint);
|
||||
BlockPos anchor = NBTUtil.readBlockPos(blueprint.getTag().getCompound("Anchor"));
|
||||
|
||||
if (activeTemplate.getSize().equals(BlockPos.ZERO)) {
|
||||
|
@ -534,7 +534,7 @@ public class SchematicannonTileEntity extends SyncedTileEntity implements ITicka
|
|||
|
||||
schematicAnchor = anchor;
|
||||
blockReader = new SchematicWorld(new HashMap<>(), new Cuboid(), schematicAnchor);
|
||||
activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, BlueprintItem.getSettings(blueprint));
|
||||
activeTemplate.addBlocksToWorld(blockReader, schematicAnchor, SchematicItem.getSettings(blueprint));
|
||||
schematicLoaded = true;
|
||||
state = State.PAUSED;
|
||||
statusMsg = "Ready";
|
||||
|
|
|
@ -13,7 +13,7 @@ import com.simibubi.create.foundation.type.Cuboid;
|
|||
import com.simibubi.create.foundation.utility.TessellatorHelper;
|
||||
import com.simibubi.create.modules.schematics.SchematicWorld;
|
||||
import com.simibubi.create.modules.schematics.client.tools.Tools;
|
||||
import com.simibubi.create.modules.schematics.item.BlueprintItem;
|
||||
import com.simibubi.create.modules.schematics.item.SchematicItem;
|
||||
import com.simibubi.create.modules.schematics.packet.SchematicPlacePacket;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -198,7 +198,7 @@ public class SchematicHandler {
|
|||
AllPackets.channel.sendToServer(new NbtPacket(item, slot));
|
||||
|
||||
if (deployed) {
|
||||
Template schematic = BlueprintItem.getSchematic(item);
|
||||
Template schematic = SchematicItem.getSchematic(item);
|
||||
|
||||
if (schematic.getSize().equals(BlockPos.ZERO))
|
||||
return;
|
||||
|
|
|
@ -12,9 +12,9 @@ import net.minecraft.util.text.StringTextComponent;
|
|||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlueprintAndQuillItem extends Item {
|
||||
public class SchematicAndQuillItem extends Item {
|
||||
|
||||
public BlueprintAndQuillItem(Properties properties) {
|
||||
public SchematicAndQuillItem(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
|
@ -39,9 +39,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.common.thread.SidedThreadGroups;
|
||||
|
||||
public class BlueprintItem extends Item {
|
||||
public class SchematicItem extends Item {
|
||||
|
||||
public BlueprintItem(Properties properties) {
|
||||
public SchematicItem(Properties properties) {
|
||||
super(properties.maxStackSize(1));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class BlueprintItem extends Item {
|
|||
|
||||
writeSize(blueprint);
|
||||
blueprint.setDisplayName(new StringTextComponent(TextFormatting.RESET + "" + TextFormatting.WHITE
|
||||
+ "Blueprint (" + TextFormatting.GOLD + schematic + TextFormatting.WHITE + ")"));
|
||||
+ "Schematic (" + TextFormatting.GOLD + schematic + TextFormatting.WHITE + ")"));
|
||||
|
||||
return blueprint;
|
||||
}
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.modules.schematics.packet;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import com.simibubi.create.foundation.packet.SimplePacketBase;
|
||||
import com.simibubi.create.modules.schematics.item.BlueprintItem;
|
||||
import com.simibubi.create.modules.schematics.item.SchematicItem;
|
||||
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -31,9 +31,9 @@ public class SchematicPlacePacket extends SimplePacketBase {
|
|||
public void handle(Supplier<Context> context) {
|
||||
context.get().enqueueWork(() -> {
|
||||
ServerPlayerEntity player = context.get().getSender();
|
||||
Template t = BlueprintItem.getSchematic(stack);
|
||||
Template t = SchematicItem.getSchematic(stack);
|
||||
t.addBlocksToWorld(player.getServerWorld(), NBTUtil.readBlockPos(stack.getTag().getCompound("Anchor")),
|
||||
BlueprintItem.getSettings(stack));
|
||||
SchematicItem.getSettings(stack));
|
||||
});
|
||||
context.get().setPacketHandled(true);
|
||||
}
|
||||
|
|
|
@ -6,11 +6,18 @@
|
|||
"item.create.andesite_alloy_cube": "Andesite Alloy",
|
||||
"item.create.blaze_brass_cube": "Blaze Brass",
|
||||
"item.create.chorus_chrome_cube": "Chorus Chrome",
|
||||
"item.create.chromatic_compound_cube": "Chromatic Compound",
|
||||
"item.create.shadow_steel_cube": "Shadow Steel",
|
||||
"item.create.blueprint_and_quill": "Schematic and Quill",
|
||||
"item.create.blueprint": "Schematic",
|
||||
"item.create.belt_connector": "Mechanical Belt",
|
||||
"item.create.filter": "Filter",
|
||||
|
||||
"item.create.blazing_pickaxe": "Blazing Pickaxe",
|
||||
"item.create.blazing_shovel": "Blazing Shovel",
|
||||
"item.create.blazing_axe": "Blazing Axe",
|
||||
"item.create.blazing_sword": "Blazing Longsword",
|
||||
|
||||
"block.create.cogwheel": "Cogwheel",
|
||||
"block.create.large_cogwheel": "Large Cogwheel",
|
||||
"block.create.turntable": "Turntable",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/blazing_axe"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/blazing_pickaxe"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/blazing_shovel"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/blazing_sword"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/chromatic_compound_0",
|
||||
"layer1": "create:item/chromatic_compound_1",
|
||||
"layer2": "create:item/chromatic_compound_2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "create:item/shadow_steel_cube"
|
||||
}
|
||||
}
|
BIN
src/main/resources/assets/create/textures/item/blazing_axe.png
Normal file
After Width: | Height: | Size: 325 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 351 B |
BIN
src/main/resources/assets/create/textures/item/blazing_sword.png
Normal file
After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 435 B |
After Width: | Height: | Size: 622 B |
After Width: | Height: | Size: 671 B |
After Width: | Height: | Size: 481 B |