Compare commits

..

No commits in common. "bb221cb623062bc1508126e6fbcbdc06fc89f6c0" and "f8b618a1d24dd5ea960f3f74fd18144f7fc1bab2" have entirely different histories.

4 changed files with 3 additions and 27 deletions

View file

@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '1.9.5'
version = '1.9.4'
group = 'de.ellpeck.prettypipes' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'PrettyPipes'

View file

@ -21,8 +21,6 @@ import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks;
@ -31,10 +29,8 @@ import net.minecraftforge.items.ItemHandlerHelper;
import javax.annotation.Nullable;
import java.util.List;
import java.util.UUID;
public class ItemTerminalBlock extends ContainerBlock {
public ItemTerminalBlock() {
super(Properties.create(Material.ROCK).hardnessAndResistance(3).sound(SoundType.STONE));
}
@ -42,14 +38,8 @@ public class ItemTerminalBlock extends ContainerBlock {
@Override
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult result) {
ItemTerminalTileEntity tile = Utility.getTileEntity(ItemTerminalTileEntity.class, worldIn, pos);
if (tile == null)
if (tile == null || tile.getConnectedPipe() == null)
return ActionResultType.PASS;
String reason = tile.getInvalidTerminalReason();
if (reason != null) {
if (!worldIn.isRemote)
player.sendMessage(new TranslationTextComponent(reason).mergeStyle(TextFormatting.RED), UUID.randomUUID());
return ActionResultType.SUCCESS;
}
if (!worldIn.isRemote) {
NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos);
tile.updateItems(player);

View file

@ -112,18 +112,6 @@ public class ItemTerminalTileEntity extends TileEntity implements INamedContaine
this.lazyThis.invalidate();
}
public String getInvalidTerminalReason() {
PipeNetwork network = PipeNetwork.get(this.world);
long pipes = Arrays.stream(Direction.values())
.map(d -> network.getPipe(this.pos.offset(d)))
.filter(Objects::nonNull).count();
if (pipes <= 0)
return "info." + PrettyPipes.ID + ".no_pipe_connected";
if (pipes > 1)
return "info." + PrettyPipes.ID + ".too_many_pipes_connected";
return null;
}
public PipeTileEntity getConnectedPipe() {
PipeNetwork network = PipeNetwork.get(this.world);
for (Direction dir : Direction.values()) {

View file

@ -85,7 +85,5 @@
"info.prettypipes.energy": "%s / %s FE",
"info.prettypipes.crafting": "Awaiting",
"info.prettypipes.cancel_all": "Cancel",
"info.prettypipes.cancel_all.desc": "Stops waiting for current crafting outputs\nDoesn't remove inputs from blocks",
"info.prettypipes.no_pipe_connected": "The terminal needs to be connected to a pipe network",
"info.prettypipes.too_many_pipes_connected": "The terminal can only be connected to a single pipe at a time"
"info.prettypipes.cancel_all.desc": "Stops waiting for current crafting outputs\nDoesn't remove inputs from blocks"
}