Skip to content

Commit

Permalink
ITEM PIPES (#437)
Browse files Browse the repository at this point in the history
* feat: ITEM PIPES because someone took too long and people wanted these

* fix a sync issue in fluid ingredients

* one last bug to fix: the items sometimes cycle back to the input

* finish item pipe, start on long distance pipeline

* feat: IT WORKS LESSGOOOOOOOO
except some textures are wonky, but IT WORKS LESSSGOOOOOOO

* chore: changelog, fix endpoint textures

* fix: LD pipes not saving data

* chore: fill out changelog

* Update common/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeType.java

Co-authored-by: Mikerooni <[email protected]>

* Update common/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java

Co-authored-by: Mikerooni <[email protected]>

* Update common/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java

Co-authored-by: Mikerooni <[email protected]>

* Update common/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java

Co-authored-by: Mikerooni <[email protected]>

* Update common/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java

Co-authored-by: Mikerooni <[email protected]>

* requested changes

* more getters

* add this back

---------

Co-authored-by: Mikerooni <[email protected]>
  • Loading branch information
screret and mikerooni authored Oct 4, 2023
1 parent 619e499 commit c057b9f
Show file tree
Hide file tree
Showing 127 changed files with 3,267 additions and 126 deletions.
14 changes: 6 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# ChangeLog

* fix custom veins not working in non-vanilla dimensions
* fix large miners not macerating ores properly
* fix the turbines' generation being off by factor of turbine efficiency
* fix recipes not working when a world is loaded for the first time
* fix mipmapping issue
* fix the watertight steel mixer recipe
* fix fabric fluid textures
* add fluid ingredients for fluid input/output unification
* add item pipes
* add long distance pipelines
* fix crash when joining servers
* fix pipe covers not having collision
* add oilsands veins
* fix machines sometimes losing NBT
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static BlockColor tintedColor() {
}

public int tinted(BlockState blockState, @Nullable BlockAndTintGetter blockAndTintGetter, @Nullable BlockPos blockPos, int index) {
return material.getMaterialRGB();
return index == 1 ? material.getMaterialRGB() : -1;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState
}
}

@Override
public boolean isCollisionShapeFullBlock(BlockState state, BlockGetter level, BlockPos pos) {
return false;
}

@Override
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext context) {
var pipeNode = getPileTile(pLevel, pPos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public void onChanged() {
setChanged();
}


@Override
public long getOffsetTimer() {
return level == null ? offset : (level.getGameTime() + offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,17 +705,15 @@ public static TagPrefix get(String name) {
public static final TagPrefix pipeQuadrupleFluid = new TagPrefix("pipeQuadrupleFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Quadruple %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 4).unificationEnabled(true);
public static final TagPrefix pipeNonupleFluid = new TagPrefix("pipeNonupleFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Nonuple %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 9).unificationEnabled(true);

// TODO Item pipes<
//public static final TagPrefix pipeTinyItem = new TagPrefix("pipeTinyItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Tiny %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M / 2).unificationEnabled(true);
//public static final TagPrefix pipeSmallItem = new TagPrefix("pipeSmallItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M).unificationEnabled(true);
//public static final TagPrefix pipeNormalItem = new TagPrefix("pipeNormalItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 3).unificationEnabled(true);
//public static final TagPrefix pipeLargeItem = new TagPrefix("pipeLargeItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 6).unificationEnabled(true);
//public static final TagPrefix pipeHugeItem = new TagPrefix("pipeHugeItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 12).unificationEnabled(true);

//public static final TagPrefix pipeSmallRestrictive = new TagPrefix("pipeSmallRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M).unificationEnabled(true);
//public static final TagPrefix pipeNormalRestrictive = new TagPrefix("pipeNormalRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 3).unificationEnabled(true);
//public static final TagPrefix pipeLargeRestrictive = new TagPrefix("pipeLargeRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 6).unificationEnabled(true);
//public static final TagPrefix pipeHugeRestrictive = new TagPrefix("pipeHugeRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 12).unificationEnabled(true);
public static final TagPrefix pipeSmallItem = new TagPrefix("pipeSmallItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M).unificationEnabled(true);
public static final TagPrefix pipeNormalItem = new TagPrefix("pipeNormalItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 3).unificationEnabled(true);
public static final TagPrefix pipeLargeItem = new TagPrefix("pipeLargeItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 6).unificationEnabled(true);
public static final TagPrefix pipeHugeItem = new TagPrefix("pipeHugeItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 12).unificationEnabled(true);

public static final TagPrefix pipeSmallRestrictive = new TagPrefix("pipeSmallRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M).unificationEnabled(true);
public static final TagPrefix pipeNormalRestrictive = new TagPrefix("pipeNormalRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 3).unificationEnabled(true);
public static final TagPrefix pipeLargeRestrictive = new TagPrefix("pipeLargeRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 6).unificationEnabled(true);
public static final TagPrefix pipeHugeRestrictive = new TagPrefix("pipeHugeRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTag).materialAmount(GTValues.M * 12).unificationEnabled(true);

// Wires and cables
public static final TagPrefix wireGtHex = new TagPrefix("wireGtHex").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("16x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTag).materialAmount(GTValues.M * 8).materialIconType(MaterialIconType.wire).unificationEnabled(true);
Expand Down Expand Up @@ -956,7 +954,7 @@ public boolean doGenerateItem() {
}

public boolean doGenerateItem(Material material) {
return generateItem && !isIgnored(material) && (generationCondition == null || generationCondition.test(material));
return (generateItem && !isIgnored(material) && (generationCondition == null || generationCondition.test(material))) || (hasItemTable() && this.itemTable.get() != null && getItemFromTable(material) != null);
}

public <T extends IMaterialProperty<T>> void executeHandler(PropertyKey<T> propertyKey, TriConsumer<TagPrefix, Material, T> handler) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.gregtechceu.gtceu.api.pipenet.longdistance;

import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.entity.BlockEntity;

import javax.annotation.Nullable;

public interface ILDEndpoint {

/**
* @return the current type of this endpoint (input, output or none)
*/
Type getType();

/**
* @param type new active type
*/
void setType(Type type);

/**
* @return true if this endpoint is considered a network input
*/
default boolean isInput() {
return getType() == Type.INPUT;
}

/**
* @return true if this endpoint is considered a network output
*/
default boolean isOutput() {
return getType() == Type.OUTPUT;
}

/**
* @return the currently linked endpoint or null
*/
@Nullable
ILDEndpoint getLink();

/**
* removes the linked endpoint if there is any
*/
void invalidateLink();

/**
* @return the front facing, usually the input face
*/
Direction getFrontFacing();

/**
* @return the output facing
*/
Direction getOutputFacing();

/**
* @return the ld pipe type for this endpoint
*/
LongDistancePipeType getPipeType();

/**
* @return pos in world
*/
BlockPos getPos();

static ILDEndpoint tryGet(LevelAccessor world, BlockPos pos) {
BlockEntity te = world.getBlockEntity(pos);
if (te instanceof IMachineBlockEntity iMachineBlock) {
MetaMachine mte = iMachineBlock.getMetaMachine();
if (mte instanceof ILDEndpoint) {
return (ILDEndpoint) mte;
}
}
return null;
}

enum Type {
NONE, INPUT, OUTPUT
}
}
Loading

0 comments on commit c057b9f

Please sign in to comment.