Bug Busting 0.1 Part I

- Washing recipes can now have stochastic outputs
- Splashing fans no longer spam the extinguish sound
- Mechanical Press now properly registers as a belt attachment
- Improved animations for Mechanical Press
- Fixed Pulse Repeaters staying powered under certain conditions
- Fixed Belt observer state sync issues
- Stopped Filters on tileentities from disappearing
- Fixed Item count not showing on filtered Extractors
- Fixed Filters not being properly handled by Extractors
- Fixed Extractors no longer being redstone locked on world reload
- Fixed Redstone Links being powered inconsistently
- Added a few more processing recipes
This commit is contained in:
simibubi 2019-09-17 14:57:29 +02:00
parent fc82dc33d9
commit 5c8206030c
58 changed files with 957 additions and 135 deletions

View file

@ -37,6 +37,7 @@ public enum ScreenResources {
FAN_RECIPE("recipes1.png", 0, 128, 177, 109), FAN_RECIPE("recipes1.png", 0, 128, 177, 109),
BLOCKZAPPER_UPGRADE_RECIPE("recipes2.png", 144, 66), BLOCKZAPPER_UPGRADE_RECIPE("recipes2.png", 144, 66),
PRESSER_RECIPE("recipes2.png", 0, 108, 177, 109), PRESSER_RECIPE("recipes2.png", 0, 108, 177, 109),
WASHING_RECIPE("recipes3.png", 177, 109),
// Widgets // Widgets
PALETTE_BUTTON("palette_picker.png", 0, 236, 20, 20), PALETTE_BUTTON("palette_picker.png", 0, 236, 20, 20),

View file

@ -1,20 +1,29 @@
package com.simibubi.create.compat.jei; package com.simibubi.create.compat.jei;
import java.util.Arrays;
import java.util.List;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.AllItems; import com.simibubi.create.AllItems;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.ScreenResources; import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.gui.ScreenElementRenderer; import com.simibubi.create.foundation.gui.ScreenElementRenderer;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.StochasticOutput;
import com.simibubi.create.modules.contraptions.receivers.SplashingRecipe; import com.simibubi.create.modules.contraptions.receivers.SplashingRecipe;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.FlowingFluidBlock; import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe> { public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe> {
@ -46,9 +55,37 @@ public class SplashingCategory extends ProcessingViaFanCategory<SplashingRecipe>
return Lang.translate("recipe.splashing"); return Lang.translate("recipe.splashing");
} }
@Override
public void setIngredients(SplashingRecipe recipe, IIngredients ingredients) {
ingredients.setInputIngredients(recipe.getIngredients());
ingredients.setOutputs(VanillaTypes.ITEM, recipe.getPossibleOutputs());
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, SplashingRecipe recipe, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 20, 67);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
List<StochasticOutput> results = recipe.getRollableResults();
for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) {
itemStacks.init(outputIndex + 1, false, 139, 58 + 19 * outputIndex);
itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack());
}
itemStacks.addTooltipCallback((slotIndex, input, ingredient, tooltip) -> {
if (input)
return;
StochasticOutput output = results.get(slotIndex - 1);
if (output.getChance() != 1)
tooltip.add(1, TextFormatting.GOLD
+ Lang.translate("recipe.processing.chance", (int) (output.getChance() * 100)));
});
}
@Override @Override
public IDrawable getBackground() { public IDrawable getBackground() {
return new ScreenResourceWrapper(ScreenResources.FAN_RECIPE); return new ScreenResourceWrapper(ScreenResources.WASHING_RECIPE);
} }
@Override @Override

View file

@ -100,12 +100,12 @@ public interface IBlockWithScrollableValue {
if (contains) { if (contains) {
GlStateManager.lineWidth(2); GlStateManager.lineWidth(2);
WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, .5f, 1, WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, 1, .5f,
.75f, 1f); .75f, 1f);
} else { } else {
GlStateManager.lineWidth(2); GlStateManager.lineWidth(2);
WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, .25f, WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, .5f,
.5f, .35f, 1f); .25f, .35f, 1f);
} }
tessellator.draw(); tessellator.draw();
@ -127,13 +127,13 @@ public interface IBlockWithScrollableValue {
GlStateManager.scaled(textScale, -textScale, textScale); GlStateManager.scaled(textScale, -textScale, textScale);
String text = block.getValueName(state, world, blockPos); String text = block.getValueName(state, world, blockPos);
mc.fontRenderer.drawString(text, 0, 0, 0x88FFBB); mc.fontRenderer.drawString(text, 0, 0, 0xFF88BB);
GlStateManager.translated(0, 0, -1 / 4f); GlStateManager.translated(0, 0, -1 / 4f);
mc.fontRenderer.drawString(text, 1, 1, 0x224433); mc.fontRenderer.drawString(text, 1, 1, 0x224433);
GlStateManager.translated(0, 0, 1 / 4f); GlStateManager.translated(0, 0, 1 / 4f);
text = TextFormatting.ITALIC + "<" + Lang.translate("action.scroll") + ">"; text = TextFormatting.ITALIC + "<" + Lang.translate("action.scroll") + ">";
mc.fontRenderer.drawString(text, 0, 10, 0xBBBBCC); mc.fontRenderer.drawString(text, 0, 10, 0xCCBBCC);
GlStateManager.translated(0, 0, -1 / 4f); GlStateManager.translated(0, 0, -1 / 4f);
mc.fontRenderer.drawString(text, 1, 11, 0x111111); mc.fontRenderer.drawString(text, 1, 11, 0x111111);
GlStateManager.translated(0, 0, 1 / 4f); GlStateManager.translated(0, 0, 1 / 4f);

View file

@ -243,9 +243,12 @@ public class EncasedFanTileEntity extends KineticTileEntity implements ITickable
entity.attackEntityFrom(damageSourceLava, 8); entity.attackEntityFrom(damageSourceLava, 8);
} }
if (getProcessingType() == Type.SPLASHING) { if (getProcessingType() == Type.SPLASHING) {
if (entity.isBurning()) {
entity.extinguish(); entity.extinguish();
world.playSound(null, entity.getPosition(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE, world.playSound(null, entity.getPosition(), SoundEvents.ENTITY_GENERIC_EXTINGUISH_FIRE,
SoundCategory.NEUTRAL, 0.7F, 1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F); SoundCategory.NEUTRAL, 0.7F,
1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F);
}
} }
} }
} }

View file

@ -20,6 +20,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.HorizontalBlock; import net.minecraft.block.HorizontalBlock;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.StateContainer.Builder;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -56,7 +57,7 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return; return;
if (worldIn.isBlockPowered(pos)) { if (worldIn.isBlockPowered(pos)) {
if (!te.finished && !te.running) if (!te.finished && !te.running && te.getSpeed() != 0)
te.start(false); te.start(false);
} else { } else {
te.finished = false; te.finished = false;
@ -92,17 +93,9 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return true; return true;
} }
public static class Head extends HorizontalBlock implements IRenderUtilityBlock {
public Head() {
super(Properties.from(Blocks.AIR));
}
@Override @Override
protected void fillStateContainer(Builder<Block, BlockState> builder) { public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
builder.add(HORIZONTAL_FACING); onAttachmentPlaced(worldIn, pos, state);
super.fillStateContainer(builder);
}
} }
@Override @Override
@ -110,6 +103,14 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return Arrays.asList(te.getPos().up(2)); return Arrays.asList(te.getPos().up(2));
} }
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
onAttachmentRemoved(worldIn, pos, state);
if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) {
worldIn.removeTileEntity(pos);
}
}
@Override @Override
public Optional<BlockPos> getValidBeltPositionFor(IWorld world, BlockPos pos, BlockState state) { public Optional<BlockPos> getValidBeltPositionFor(IWorld world, BlockPos pos, BlockState state) {
BlockState blockState = world.getBlockState(pos.down(2)); BlockState blockState = world.getBlockState(pos.down(2));
@ -127,6 +128,10 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
if (pressTe == null || pressTe.getSpeed() == 0) if (pressTe == null || pressTe.getSpeed() == 0)
return false; return false;
// Not an Item
if (!(entity instanceof ItemEntity))
return false;
// Running // Running
if (pressTe.running) { if (pressTe.running) {
double distanceTo = entity.getPositionVec().distanceTo(VecHelper.getCenterOf(te.getPos())); double distanceTo = entity.getPositionVec().distanceTo(VecHelper.getCenterOf(te.getPos()));
@ -142,8 +147,12 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
// Start process // Start process
if (state.processingEntity != entity) { if (state.processingEntity != entity) {
state.processingEntity = entity; state.processingEntity = entity;
if (!pressTe.getRecipe((ItemEntity) entity).isPresent()) {
state.processingDuration = -1;
} else {
state.processingDuration = 1; state.processingDuration = 1;
pressTe.start(true); pressTe.start(true);
}
return false; return false;
} }
@ -160,4 +169,17 @@ public class MechanicalPressBlock extends HorizontalKineticBlock
return false; return false;
} }
public static class Head extends HorizontalBlock implements IRenderUtilityBlock {
public Head() {
super(Properties.from(Blocks.AIR));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(HORIZONTAL_FACING);
super.fillStateContainer(builder);
}
}
} }

View file

@ -4,15 +4,21 @@ import java.util.Optional;
import com.simibubi.create.AllRecipes; import com.simibubi.create.AllRecipes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.modules.contraptions.base.KineticTileEntity; import com.simibubi.create.modules.contraptions.base.KineticTileEntity;
import com.simibubi.create.modules.logistics.InWorldProcessing; import com.simibubi.create.modules.logistics.InWorldProcessing;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.particles.ItemParticleData;
import net.minecraft.particles.ParticleTypes;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RecipeWrapper; import net.minecraftforge.items.wrapper.RecipeWrapper;
@ -59,11 +65,12 @@ public class MechanicalPressTileEntity extends KineticTileEntity implements ITic
public float getRenderedHeadOffset(float partialTicks) { public float getRenderedHeadOffset(float partialTicks) {
if (running) { if (running) {
if (runningTicks < 50) { if (runningTicks < 40) {
return MathHelper.clamp((runningTicks - 1 + partialTicks) / 20f, 0, beltMode ? 1 + 3 / 16f : 1); float num = (runningTicks - 1 + partialTicks) / 30f;
return MathHelper.clamp(num * num * num, 0, beltMode ? 1 + 3 / 16f : 1);
} }
if (runningTicks >= 50) { if (runningTicks >= 40) {
return MathHelper.clamp(((100 - runningTicks) + 1 - partialTicks) / 20f, 0, beltMode ? 1 + 3 / 16f : 1); return MathHelper.clamp(((60 - runningTicks) + 1 - partialTicks) / 20f, 0, beltMode ? 1 + 3 / 16f : 1);
} }
} }
return 0; return 0;
@ -81,21 +88,34 @@ public class MechanicalPressTileEntity extends KineticTileEntity implements ITic
if (!running) if (!running)
return; return;
if (!world.isRemote && runningTicks > 100) { if (runningTicks == 30) {
AxisAlignedBB bb = new AxisAlignedBB(pos.down(beltMode ? 2 : 1)); AxisAlignedBB bb = new AxisAlignedBB(pos.down(beltMode ? 2 : 1));
for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, bb)) { for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, bb)) {
if (!(entity instanceof ItemEntity)) if (!(entity instanceof ItemEntity))
continue; continue;
ItemEntity itemEntity = (ItemEntity) entity; ItemEntity itemEntity = (ItemEntity) entity;
pressingInv.setInventorySlotContents(0, itemEntity.getItem());
Optional<PressingRecipe> recipe = world.getRecipeManager().getRecipe(AllRecipes.Types.PRESSING, if (world.isRemote) {
pressingInv, world); for (int i = 0; i < 20; i++) {
Vec3d motion = VecHelper.offsetRandomly(Vec3d.ZERO, world.rand, .25f).mul(1, 0, 1);
world.addParticle(new ItemParticleData(ParticleTypes.ITEM, itemEntity.getItem()), entity.posX,
entity.posY, entity.posZ, motion.x, motion.y, motion.z);
}
}
if (!world.isRemote) {
Optional<PressingRecipe> recipe = getRecipe(itemEntity);
if (recipe.isPresent()) if (recipe.isPresent())
InWorldProcessing.applyRecipeOn(itemEntity, recipe.get()); InWorldProcessing.applyRecipeOn(itemEntity, recipe.get());
} }
}
if (!world.isRemote) {
world.playSound(null, getPos(), SoundEvents.ENTITY_ITEM_BREAK, SoundCategory.BLOCKS, .5f, 1f);
world.playSound(null, getPos(), SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, .125f, 1f);
}
}
if (!world.isRemote && runningTicks > 60) {
finished = true; finished = true;
if (!beltMode) if (!beltMode)
finished = world.isBlockPowered(pos); finished = world.isBlockPowered(pos);
@ -107,4 +127,11 @@ public class MechanicalPressTileEntity extends KineticTileEntity implements ITic
runningTicks++; runningTicks++;
} }
public Optional<PressingRecipe> getRecipe(ItemEntity itemEntity) {
pressingInv.setInventorySlotContents(0, itemEntity.getItem());
Optional<PressingRecipe> recipe = world.getRecipeManager().getRecipe(AllRecipes.Types.PRESSING, pressingInv,
world);
return recipe;
}
} }

View file

@ -6,6 +6,7 @@ import java.util.Optional;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -76,9 +77,11 @@ public enum AllBeltAttachments {
public static class Tracker { public static class Tracker {
public List<BeltAttachmentState> attachments; public List<BeltAttachmentState> attachments;
private BeltTileEntity te;
public Tracker() { public Tracker(BeltTileEntity te) {
attachments = new ArrayList<>(0); attachments = new ArrayList<>(0);
this.te = te;
} }
public void findAttachments(BeltTileEntity belt) { public void findAttachments(BeltTileEntity belt) {
@ -103,8 +106,13 @@ public enum AllBeltAttachments {
public BeltAttachmentState addAttachment(IWorld world, BlockPos pos) { public BeltAttachmentState addAttachment(IWorld world, BlockPos pos) {
BlockState state = world.getBlockState(pos); BlockState state = world.getBlockState(pos);
removeAttachment(pos); removeAttachment(pos);
if (!(state.getBlock() instanceof IBeltAttachment)) {
Create.logger.warn("Missing belt attachment for Belt at " + pos.toString());
return null;
}
BeltAttachmentState newAttachmentState = new BeltAttachmentState((IBeltAttachment) state.getBlock(), pos); BeltAttachmentState newAttachmentState = new BeltAttachmentState((IBeltAttachment) state.getBlock(), pos);
attachments.add(newAttachmentState); attachments.add(newAttachmentState);
te.markDirty();
return newAttachmentState; return newAttachmentState;
} }
@ -115,6 +123,7 @@ public enum AllBeltAttachments {
toRemove = atState; toRemove = atState;
if (toRemove != null) if (toRemove != null)
attachments.remove(toRemove); attachments.remove(toRemove);
te.markDirty();
} }
public void forEachAttachment(Consumer<BeltAttachmentState> consumer) { public void forEachAttachment(Consumer<BeltAttachmentState> consumer) {
@ -131,6 +140,8 @@ public enum AllBeltAttachments {
CompoundNBT stateNBT = (CompoundNBT) data; CompoundNBT stateNBT = (CompoundNBT) data;
BlockPos attachmentPos = NBTUtil.readBlockPos(stateNBT.getCompound("Position")); BlockPos attachmentPos = NBTUtil.readBlockPos(stateNBT.getCompound("Position"));
BeltAttachmentState atState = addAttachment(belt.getWorld(), attachmentPos); BeltAttachmentState atState = addAttachment(belt.getWorld(), attachmentPos);
if (atState == null)
continue;
atState.processingDuration = stateNBT.getInt("Duration"); atState.processingDuration = stateNBT.getInt("Duration");
} }
} }

View file

@ -66,7 +66,7 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn
public BeltTileEntity() { public BeltTileEntity() {
super(AllTileEntities.BELT.type); super(AllTileEntities.BELT.type);
controller = BlockPos.ZERO; controller = BlockPos.ZERO;
attachmentTracker = new Tracker(); attachmentTracker = new Tracker(this);
color = -1; color = -1;
} }
@ -187,15 +187,6 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn
return; return;
} }
if (entityIn instanceof ItemEntity) {
if (speed == 0) {
((ItemEntity) entityIn).setAgeToCreativeDespawnTime();
} else {
if (((ItemEntity) entityIn).getAge() > 0)
((ItemEntity) entityIn).setNoDespawn();
}
}
if (speed == 0) if (speed == 0)
return; return;
@ -227,7 +218,8 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn
Vec3d movement = new Vec3d(movementDirection.getDirectionVec()).scale(movementSpeed); Vec3d movement = new Vec3d(movementDirection.getDirectionVec()).scale(movementSpeed);
double diffCenter = axis == Axis.Z ? (pos.getX() + .5f - entityIn.posX) : (pos.getZ() + .5f - entityIn.posZ); double diffCenter = axis == Axis.Z ? (pos.getX() + .5f - entityIn.posX) : (pos.getZ() + .5f - entityIn.posZ);
if (Math.abs(diffCenter) > 48 / 64f) float maxDiffCenter = (entityIn instanceof ItemEntity)? 32 / 64f : 48 / 64f;
if (Math.abs(diffCenter) > maxDiffCenter)
return; return;
Part part = blockState.get(BeltBlock.PART); Part part = blockState.get(BeltBlock.PART);
@ -257,7 +249,7 @@ public class BeltTileEntity extends KineticTileEntity implements ITickableTileEn
entityIn.stepHeight = 1; entityIn.stepHeight = 1;
if (Math.abs(movementSpeed) < .5f) { if (Math.abs(movementSpeed) < .5f) {
Vec3d checkDistance = movement.scale(2f).add(movement.normalize().scale(.5)); Vec3d checkDistance = movement.scale(2f).add(movement.normalize());
AxisAlignedBB bb = entityIn.getBoundingBox(); AxisAlignedBB bb = entityIn.getBoundingBox();
AxisAlignedBB checkBB = new AxisAlignedBB(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ); AxisAlignedBB checkBB = new AxisAlignedBB(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
if (!world if (!world

View file

@ -32,7 +32,7 @@ public class FrequencyHandler {
} }
public ItemStack getStack() { public ItemStack getStack() {
return stack; return stack.copy();
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package com.simibubi.create.modules.logistics; package com.simibubi.create.modules.logistics;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -10,7 +11,6 @@ import com.simibubi.create.modules.contraptions.receivers.SplashingRecipe;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.BlastingRecipe; import net.minecraft.item.crafting.BlastingRecipe;
import net.minecraft.item.crafting.FurnaceRecipe; import net.minecraft.item.crafting.FurnaceRecipe;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
@ -21,6 +21,7 @@ import net.minecraft.tileentity.BlastFurnaceTileEntity;
import net.minecraft.tileentity.FurnaceTileEntity; import net.minecraft.tileentity.FurnaceTileEntity;
import net.minecraft.tileentity.SmokerTileEntity; import net.minecraft.tileentity.SmokerTileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.wrapper.RecipeWrapper; import net.minecraftforge.items.wrapper.RecipeWrapper;
@ -111,7 +112,7 @@ public class InWorldProcessing {
} }
} }
entity.setItem(new ItemStack(Items.GUNPOWDER, entity.getItem().getCount())); entity.remove();
return; return;
} }
@ -144,10 +145,38 @@ public class InWorldProcessing {
} }
public static void applyRecipeOn(ItemEntity entity, IRecipe<?> recipe) { public static void applyRecipeOn(ItemEntity entity, IRecipe<?> recipe) {
List<ItemStack> stacks;
if (recipe instanceof SplashingRecipe) {
stacks = new ArrayList<>();
for (int i = 0; i < entity.getItem().getCount(); i++) {
for (ItemStack stack : ((SplashingRecipe) recipe).rollResults()) {
for (ItemStack previouslyRolled : stacks) {
if (stack.isEmpty())
continue;
if (!ItemHandlerHelper.canItemStacksStack(stack, previouslyRolled))
continue;
int amount = Math.min(previouslyRolled.getMaxStackSize() - previouslyRolled.getCount(),
stack.getCount());
previouslyRolled.grow(amount);
stack.shrink(amount);
}
if (stack.isEmpty())
continue;
stacks.add(stack);
}
}
} else {
ItemStack out = recipe.getRecipeOutput().copy(); ItemStack out = recipe.getRecipeOutput().copy();
List<ItemStack> stacks = ItemHelper.multipliedOutput(entity.getItem(), out); stacks = ItemHelper.multipliedOutput(entity.getItem(), out);
if (stacks.isEmpty()) }
if (stacks.isEmpty()) {
entity.remove();
return; return;
}
entity.setItem(stacks.remove(0)); entity.setItem(stacks.remove(0));
for (ItemStack additional : stacks) for (ItemStack additional : stacks)
entity.world.addEntity(new ItemEntity(entity.world, entity.posX, entity.posY, entity.posZ, additional)); entity.world.addEntity(new ItemEntity(entity.world, entity.posX, entity.posY, entity.posZ, additional));

View file

@ -10,6 +10,8 @@ import net.minecraft.particles.ItemParticleData;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.ParticleTypes;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i; import net.minecraft.util.math.Vec3i;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -92,8 +94,10 @@ public class BeltFunnelTileEntity extends SyncedTileEntity implements ITickableT
for (int slot = 0; slot < inv.getSlots(); slot++) { for (int slot = 0; slot < inv.getSlots(); slot++) {
stack = inv.insertItem(slot, stack, world.isRemote); stack = inv.insertItem(slot, stack, world.isRemote);
if (stack.isEmpty()) { if (stack.isEmpty()) {
if (!world.isRemote) if (!world.isRemote) {
entity.remove(); entity.remove();
world.playSound(null, pos, SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.BLOCKS, .125f, 1f);
}
else { else {
Vec3i directionVec = getBlockState().get(BlockStateProperties.HORIZONTAL_FACING).getDirectionVec(); Vec3i directionVec = getBlockState().get(BlockStateProperties.HORIZONTAL_FACING).getDirectionVec();
float xSpeed = directionVec.getX() * 1/8f; float xSpeed = directionVec.getX() * 1/8f;

View file

@ -179,6 +179,9 @@ public class EntityDetectorBlock extends HorizontalBlock
@Override @Override
public boolean handleEntity(BeltTileEntity te, Entity entity, BeltAttachmentState state) { public boolean handleEntity(BeltTileEntity te, Entity entity, BeltAttachmentState state) {
if (te.getWorld().isRemote)
return false;
if (state.processingEntity != entity) { if (state.processingEntity != entity) {
state.processingEntity = entity; state.processingEntity = entity;
state.processingDuration = 0; state.processingDuration = 0;
@ -207,7 +210,7 @@ public class EntityDetectorBlock extends HorizontalBlock
state.processingDuration = -1; state.processingDuration = -1;
world.setBlockState(state.attachmentPos, blockState.with(POWERED, true)); world.setBlockState(state.attachmentPos, blockState.with(POWERED, true));
world.getPendingBlockTicks().scheduleTick(state.attachmentPos, this, 4); world.getPendingBlockTicks().scheduleTick(state.attachmentPos, this, 6);
world.notifyNeighborsOfStateChange(state.attachmentPos, this); world.notifyNeighborsOfStateChange(state.attachmentPos, this);
return false; return false;
@ -215,7 +218,7 @@ public class EntityDetectorBlock extends HorizontalBlock
@Override @Override
public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { public void tick(BlockState state, World worldIn, BlockPos pos, Random random) {
worldIn.setBlockState(pos, state.with(POWERED, false)); worldIn.setBlockState(pos, state.with(POWERED, false), 2);
worldIn.notifyNeighborsOfStateChange(pos, this); worldIn.notifyNeighborsOfStateChange(pos, this);
} }

View file

@ -29,13 +29,14 @@ public class EntityDetectorTileEntity extends SyncedTileEntity implements IHaveF
@Override @Override
public void setFilter(ItemStack stack) { public void setFilter(ItemStack stack) {
filter = stack; filter = stack.copy();
markDirty();
sendData(); sendData();
} }
@Override @Override
public ItemStack getFilter() { public ItemStack getFilter() {
return filter; return filter.copy();
} }
} }

View file

@ -16,8 +16,8 @@ import net.minecraft.state.StateContainer.Builder;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@ -48,6 +48,11 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
super.fillStateContainer(builder); super.fillStateContainer(builder);
} }
@Override
public boolean showsCount() {
return true;
}
@Override @Override
public boolean hasTileEntity(BlockState state) { public boolean hasTileEntity(BlockState state) {
return true; return true;
@ -80,8 +85,6 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
@Override @Override
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) { public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
updateObservedInventory(state, worldIn, pos); updateObservedInventory(state, worldIn, pos);
cacheItemPositions();
} }
@Override @Override
@ -137,8 +140,6 @@ public class ExtractorBlock extends HorizontalBlock implements IBlockWithFilter
} }
private void cacheItemPositions() { private void cacheItemPositions() {
// if (!itemPositions.isEmpty())
// return;
itemPositions.clear(); itemPositions.clear();
Vec3d position = Vec3d.ZERO; Vec3d position = Vec3d.ZERO;

View file

@ -22,7 +22,8 @@ public class ExtractorTileEntity extends SyncedTileEntity implements IExtractor,
public ExtractorTileEntity() { public ExtractorTileEntity() {
super(AllTileEntities.EXTRACTOR.type); super(AllTileEntities.EXTRACTOR.type);
state = State.WAITING_FOR_INVENTORY; state = State.ON_COOLDOWN;
cooldown = CreateConfig.parameters.extractorDelay.get();
inventory = LazyOptional.empty(); inventory = LazyOptional.empty();
filter = ItemStack.EMPTY; filter = ItemStack.EMPTY;
} }
@ -35,12 +36,15 @@ public class ExtractorTileEntity extends SyncedTileEntity implements IExtractor,
@Override @Override
public void read(CompoundNBT compound) { public void read(CompoundNBT compound) {
filter = ItemStack.read(compound.getCompound("Filter")); filter = ItemStack.read(compound.getCompound("Filter"));
if (compound.getBoolean("Locked"))
setState(State.LOCKED);
super.read(compound); super.read(compound);
} }
@Override @Override
public CompoundNBT write(CompoundNBT compound) { public CompoundNBT write(CompoundNBT compound) {
compound.put("Filter", filter.serializeNBT()); compound.put("Filter", filter.serializeNBT());
compound.putBoolean("Locked", getState() == State.LOCKED);
return super.write(compound); return super.write(compound);
} }
@ -52,6 +56,8 @@ public class ExtractorTileEntity extends SyncedTileEntity implements IExtractor,
@Override @Override
public void tick() { public void tick() {
if (initialize && hasWorld()) { if (initialize && hasWorld()) {
if (world.isBlockPowered(pos))
state = State.LOCKED;
neighborChanged(); neighborChanged();
initialize = false; initialize = false;
} }
@ -87,13 +93,15 @@ public class ExtractorTileEntity extends SyncedTileEntity implements IExtractor,
@Override @Override
public void setFilter(ItemStack stack) { public void setFilter(ItemStack stack) {
filter = stack; filter = stack.copy();
markDirty();
sendData(); sendData();
neighborChanged();
} }
@Override @Override
public ItemStack getFilter() { public ItemStack getFilter() {
return filter; return filter.copy();
} }
} }

View file

@ -6,6 +6,7 @@ import com.simibubi.create.foundation.utility.TessellatorHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.WorldRenderer;
@ -40,13 +41,17 @@ public interface IBlockWithFilter {
return 2 / 16f; return 2 / 16f;
} }
public default boolean handleActivatedFilterSlots(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, public default boolean showsCount() {
Hand handIn, BlockRayTraceResult hit) { return false;
}
public default boolean handleActivatedFilterSlots(BlockState state, World worldIn, BlockPos pos,
PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
TileEntity te = worldIn.getTileEntity(pos); TileEntity te = worldIn.getTileEntity(pos);
if (te == null || !(te instanceof IHaveFilter)) if (te == null || !(te instanceof IHaveFilter))
return false; return false;
IHaveFilter actor = (IHaveFilter) te; IHaveFilter actor = (IHaveFilter) te;
Vec3d vec = new Vec3d(pos); Vec3d vec = new Vec3d(pos);
Vec3d position = vec.add(getFilterPosition(state)); Vec3d position = vec.add(getFilterPosition(state));
ItemStack stack = player.getHeldItem(handIn); ItemStack stack = player.getHeldItem(handIn);
@ -75,13 +80,18 @@ public interface IBlockWithFilter {
if (!(state.getBlock() instanceof IBlockWithFilter)) if (!(state.getBlock() instanceof IBlockWithFilter))
return; return;
TileEntity te = world.getTileEntity(pos);
if (te == null || !(te instanceof IHaveFilter))
return;
IHaveFilter actor = (IHaveFilter) te;
IBlockWithFilter filterBlock = (IBlockWithFilter) state.getBlock(); IBlockWithFilter filterBlock = (IBlockWithFilter) state.getBlock();
Vec3d vec = new Vec3d(pos); Vec3d vec = new Vec3d(pos);
Vec3d position = filterBlock.getFilterPosition(state).add(vec); Vec3d position = filterBlock.getFilterPosition(state).add(vec);
float scale = filterBlock.getItemHitboxScale(); float scale = filterBlock.getItemHitboxScale();
AxisAlignedBB bb = new AxisAlignedBB(position, position).grow(scale, scale / 1.25f, scale).offset(0, -scale / 16f, 0); AxisAlignedBB bb = new AxisAlignedBB(position, position).grow(scale, scale / 1.25f, scale).offset(0,
-scale / 16f, 0);
boolean contains = bb.grow(scale).contains(result.getHitVec()); boolean contains = bb.grow(scale).contains(result.getHitVec());
TessellatorHelper.prepareForDrawing(); TessellatorHelper.prepareForDrawing();
@ -108,10 +118,12 @@ public interface IBlockWithFilter {
if (contains) { if (contains) {
GlStateManager.lineWidth(2); GlStateManager.lineWidth(2);
WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, .5f, 1, .75f, 1f); WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, .5f, 1,
.75f, 1f);
} else { } else {
GlStateManager.lineWidth(2); GlStateManager.lineWidth(2);
WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, .25f, .5f, .35f, 1f); WorldRenderer.drawBoundingBox(bufferbuilder, bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, .25f,
.5f, .35f, 1f);
} }
tessellator.draw(); tessellator.draw();
@ -121,7 +133,7 @@ public interface IBlockWithFilter {
GlStateManager.depthMask(true); GlStateManager.depthMask(true);
if (contains) { if (contains) {
float textScale = 1/128f; float textScale = 1 / 128f;
GlStateManager.translated(position.x, position.y, position.z); GlStateManager.translated(position.x, position.y, position.z);
GlStateManager.rotated(facing.getHorizontalAngle() * (facing.getAxis() == Axis.X ? -1 : 1), 0, 1, 0); GlStateManager.rotated(facing.getHorizontalAngle() * (facing.getAxis() == Axis.X ? -1 : 1), 0, 1, 0);
GlStateManager.scaled(textScale, -textScale, textScale); GlStateManager.scaled(textScale, -textScale, textScale);
@ -129,9 +141,19 @@ public interface IBlockWithFilter {
GlStateManager.rotated(67.5f, 1, 0, 0); GlStateManager.rotated(67.5f, 1, 0, 0);
String text = Lang.translate("logistics.filter"); String text = Lang.translate("logistics.filter");
Minecraft.getInstance().fontRenderer.drawString(text, 0, 0, 0x88FFBB); FontRenderer font = Minecraft.getInstance().fontRenderer;
GlStateManager.translated(0, 0, -1/4f); font.drawString(text, 0, 0, 0x88FFBB);
Minecraft.getInstance().fontRenderer.drawString(text, 1, 1, 0x224433); GlStateManager.translated(0, 0, -1 / 4f);
font.drawString(text, 1, 1, 0x224433);
if (filterBlock.showsCount() && !actor.getFilter().isEmpty()) {
String count = actor.getFilter().getCount() + "";
GlStateManager.translated(-7 - font.getStringWidth(count), 10, 10 + 1 / 4f);
GlStateManager.scaled(1.5,1.5, 1.5);
font.drawString(count, 0, 0, 0xEDEDED);
GlStateManager.translated(0, 0, -1 / 4f);
font.drawString(count, 1, 1, 0x4F4F4F);
}
} }
GlStateManager.disableBlend(); GlStateManager.disableBlend();

View file

@ -6,6 +6,8 @@ import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -36,8 +38,11 @@ public interface IExtractor extends ITickableTileEntity, IInventoryManipulator {
if (state == State.ON_COOLDOWN) { if (state == State.ON_COOLDOWN) {
int cooldown = tickCooldown(); int cooldown = tickCooldown();
if (cooldown <= 0) if (cooldown <= 0) {
setState(State.RUNNING); setState(State.RUNNING);
if (!getInventory().isPresent())
findNewInventory();
}
return; return;
} }
@ -48,9 +53,8 @@ public interface IExtractor extends ITickableTileEntity, IInventoryManipulator {
if (hasSpace && hasInventory) { if (hasSpace && hasInventory) {
toExtract = extract(true); toExtract = extract(true);
ItemStack filter = (this instanceof IHaveFilter) ? filter = ((IHaveFilter) this).getFilter() ItemStack filterItem = (this instanceof IHaveFilter) ? ((IHaveFilter) this).getFilter() : ItemStack.EMPTY;
: ItemStack.EMPTY; if (!filterItem.isEmpty() && !ItemStack.areItemsEqual(toExtract, filterItem))
if (!filter.isEmpty() && !ItemStack.areItemsEqual(toExtract, filter))
toExtract = ItemStack.EMPTY; toExtract = ItemStack.EMPTY;
} }
@ -91,9 +95,8 @@ public interface IExtractor extends ITickableTileEntity, IInventoryManipulator {
if (hasSpace && hasInventory) { if (hasSpace && hasInventory) {
toExtract = extract(true); toExtract = extract(true);
ItemStack filter = (this instanceof IHaveFilter) ? filter = ((IHaveFilter) this).getFilter() ItemStack filterItem = (this instanceof IHaveFilter) ? ((IHaveFilter) this).getFilter() : ItemStack.EMPTY;
: ItemStack.EMPTY; if (!filterItem.isEmpty() && !ItemStack.areItemsEqual(toExtract, filterItem))
if (!filter.isEmpty() && !ItemStack.areItemsEqual(toExtract, filter))
toExtract = ItemStack.EMPTY; toExtract = ItemStack.EMPTY;
} }
@ -116,12 +119,23 @@ public interface IExtractor extends ITickableTileEntity, IInventoryManipulator {
default ItemStack extract(boolean simulate) { default ItemStack extract(boolean simulate) {
IItemHandler inv = getInventory().orElse(null); IItemHandler inv = getInventory().orElse(null);
ItemStack extracting = ItemStack.EMPTY; ItemStack extracting = ItemStack.EMPTY;
ItemStack filter = (this instanceof IHaveFilter) ? filter = ((IHaveFilter) this).getFilter() : ItemStack.EMPTY; ItemStack filterItem = (this instanceof IHaveFilter) ? ((IHaveFilter) this).getFilter() : ItemStack.EMPTY;
int extractionCount = filter.isEmpty() ? CreateConfig.parameters.extractorAmount.get() : filter.getCount(); int extractionCount = filterItem.isEmpty() ? CreateConfig.parameters.extractorAmount.get()
: filterItem.getCount();
boolean checkHasEnoughItems = !filterItem.isEmpty();
boolean hasEnoughItems = !checkHasEnoughItems;
Extraction: do {
extracting = ItemStack.EMPTY;
for (int slot = 0; slot < inv.getSlots(); slot++) { for (int slot = 0; slot < inv.getSlots(); slot++) {
ItemStack stack = inv.extractItem(slot, extractionCount - extracting.getCount(), true); ItemStack stack = inv.extractItem(slot, extractionCount - extracting.getCount(), true);
ItemStack compare = stack.copy(); ItemStack compare = stack.copy();
compare.setCount(filterItem.getCount());
if (!filterItem.isEmpty() && !filterItem.equals(compare, false))
continue;
compare.setCount(extracting.getCount()); compare.setCount(extracting.getCount());
if (!extracting.isEmpty() && !extracting.equals(compare, false)) if (!extracting.isEmpty() && !extracting.equals(compare, false))
continue; continue;
@ -131,18 +145,33 @@ public interface IExtractor extends ITickableTileEntity, IInventoryManipulator {
else else
extracting.grow(stack.getCount()); extracting.grow(stack.getCount());
if (!simulate) if (!simulate && hasEnoughItems)
inv.extractItem(slot, stack.getCount(), false); inv.extractItem(slot, stack.getCount(), false);
if (extracting.getCount() >= extractionCount)
break; if (extracting.getCount() >= extractionCount) {
if (checkHasEnoughItems) {
hasEnoughItems = true;
checkHasEnoughItems = false;
continue Extraction;
} else {
break Extraction;
}
}
} }
if (!simulate) { if (checkHasEnoughItems)
checkHasEnoughItems = false;
else
break Extraction;
} while (true);
if (!simulate && hasEnoughItems) {
World world = getWorld(); World world = getWorld();
Vec3d pos = VecHelper.getCenterOf(getPos()).add(0, -0.5f, 0); Vec3d pos = VecHelper.getCenterOf(getPos()).add(0, -0.5f, 0);
ItemEntity entityIn = new ItemEntity(world, pos.x, pos.y, pos.z, extracting); ItemEntity entityIn = new ItemEntity(world, pos.x, pos.y, pos.z, extracting);
entityIn.setMotion(Vec3d.ZERO); entityIn.setMotion(Vec3d.ZERO);
world.addEntity(entityIn); world.addEntity(entityIn);
world.playSound(null, getPos(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, .125f, .1f);
} }
return extracting; return extracting;

View file

@ -23,14 +23,21 @@ public class LinkedExtractorTileEntity extends LinkedTileEntity
private ItemStack filter; private ItemStack filter;
private int cooldown; private int cooldown;
private LazyOptional<IItemHandler> inventory; private LazyOptional<IItemHandler> inventory;
private boolean initialize;
public LinkedExtractorTileEntity() { public LinkedExtractorTileEntity() {
super(AllTileEntities.LINKED_EXTRACTOR.type); super(AllTileEntities.LINKED_EXTRACTOR.type);
state = State.WAITING_FOR_INVENTORY; setState(State.ON_COOLDOWN);
inventory = LazyOptional.empty(); inventory = LazyOptional.empty();
filter = ItemStack.EMPTY; filter = ItemStack.EMPTY;
} }
@Override
public void onLoad() {
super.onLoad();
initialize = true;
}
@Override @Override
public void setSignal(boolean powered) { public void setSignal(boolean powered) {
receivedSignal = powered; receivedSignal = powered;
@ -39,18 +46,29 @@ public class LinkedExtractorTileEntity extends LinkedTileEntity
@Override @Override
public void read(CompoundNBT compound) { public void read(CompoundNBT compound) {
filter = ItemStack.read(compound.getCompound("Filter")); filter = ItemStack.read(compound.getCompound("Filter"));
if (compound.getBoolean("Locked"))
setState(State.LOCKED);
super.read(compound); super.read(compound);
} }
@Override @Override
public CompoundNBT write(CompoundNBT compound) { public CompoundNBT write(CompoundNBT compound) {
compound.put("Filter", filter.serializeNBT()); compound.put("Filter", filter.serializeNBT());
compound.putBoolean("Locked", getState() == State.LOCKED);
return super.write(compound); return super.write(compound);
} }
@Override @Override
public void tick() { public void tick() {
if (initialize && hasWorld()) {
if (world.isBlockPowered(pos))
state = State.LOCKED;
neighborChanged();
initialize = false;
}
IExtractor.super.tick(); IExtractor.super.tick();
if (world.isRemote) if (world.isRemote)
return; return;
if (receivedSignal != getBlockState().get(POWERED)) { if (receivedSignal != getBlockState().get(POWERED)) {
@ -94,13 +112,15 @@ public class LinkedExtractorTileEntity extends LinkedTileEntity
@Override @Override
public void setFilter(ItemStack stack) { public void setFilter(ItemStack stack) {
filter = stack; filter = stack.copy();
markDirty();
sendData(); sendData();
neighborChanged();
} }
@Override @Override
public ItemStack getFilter() { public ItemStack getFilter() {
return filter; return filter.copy();
} }
} }

View file

@ -76,8 +76,7 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements IBloc
if (state.get(RECEIVER)) if (state.get(RECEIVER))
return; return;
boolean shouldPower = worldIn.getWorld().isBlockPowered(pos.offset(blockFacing.getOpposite())) boolean shouldPower = worldIn.getWorld().isBlockPowered(pos);
|| worldIn.getWorld().isBlockPowered(pos);
boolean previouslyPowered = state.get(POWERED); boolean previouslyPowered = state.get(POWERED);
if (previouslyPowered != shouldPower) { if (previouslyPowered != shouldPower) {
@ -151,7 +150,7 @@ public class RedstoneBridgeBlock extends ProperDirectionalBlock implements IBloc
@Override @Override
public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) { public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos pos, Direction side) {
return state.get(FACING) == Direction.UP; return state.get(FACING) == Direction.UP && side != null;
} }
@Override @Override

View file

@ -42,7 +42,7 @@ public class PulseRepeaterBlock extends RedstoneDiodeBlock {
boolean shouldPower = shouldBePowered(worldIn, pos, state); boolean shouldPower = shouldBePowered(worldIn, pos, state);
if (pulsing) { if (pulsing) {
worldIn.setBlockState(pos, state.with(POWERED, true).with(PULSING, false), 2); worldIn.setBlockState(pos, state.with(POWERED, shouldPower).with(PULSING, false), 2);
} else if (powered && !shouldPower) { } else if (powered && !shouldPower) {
worldIn.setBlockState(pos, state.with(POWERED, false).with(PULSING, false), 2); worldIn.setBlockState(pos, state.with(POWERED, false).with(PULSING, false), 2);
} else if (!powered) { } else if (!powered) {

View file

@ -546,7 +546,7 @@
"block.create.stockswitch.tooltip.action1": "Opens the _Configuration_ _Interface_", "block.create.stockswitch.tooltip.action1": "Opens the _Configuration_ _Interface_",
"block.create.redstone_bridge.tooltip": "REDSTONE LINK", "block.create.redstone_bridge.tooltip": "REDSTONE LINK",
"block.create.redstone_bridge.tooltip.summary": "Endpoints for _Wireless_ _Redstone_ connections. Can be assigned _Frequencies_ using any item. Signal can travel distances up to _128m_", "block.create.redstone_bridge.tooltip.summary": "Endpoints for _Wireless_ _Redstone_ connections. Can be assigned _Frequencies_ using any item. Signal range is limited, but reasonably far.",
"block.create.redstone_bridge.tooltip.condition1": "When Powered", "block.create.redstone_bridge.tooltip.condition1": "When Powered",
"block.create.redstone_bridge.tooltip.behaviour1": "Receiving Links of the same _Frequency_ will provide a Redstone signal.", "block.create.redstone_bridge.tooltip.behaviour1": "Receiving Links of the same _Frequency_ will provide a Redstone signal.",
"block.create.redstone_bridge.tooltip.control1": "When R-Clicked with an Item", "block.create.redstone_bridge.tooltip.control1": "When R-Clicked with an Item",

View file

@ -13,7 +13,8 @@
} }
}, },
"textures": { "textures": {
"extractor": "create:block/extractor" "extractor": "create:block/extractor",
"particle": "create:block/extractor"
}, },
"elements": [ "elements": [
{ {

View file

@ -14,7 +14,8 @@
}, },
"textures": { "textures": {
"redstone_antenna": "create:block/redstone_antenna", "redstone_antenna": "create:block/redstone_antenna",
"extractor": "create:block/extractor" "extractor": "create:block/extractor",
"particle": "create:block/extractor"
}, },
"elements": [ "elements": [
{ {

View file

@ -7,7 +7,8 @@
"mechanical_press_pole": "create:block/mechanical_press_pole", "mechanical_press_pole": "create:block/mechanical_press_pole",
"gearbox": "create:block/gearbox", "gearbox": "create:block/gearbox",
"mechanical_press_top": "create:block/mechanical_press_top", "mechanical_press_top": "create:block/mechanical_press_top",
"mechanical_press_bottom": "create:block/mechanical_press_bottom" "mechanical_press_bottom": "create:block/mechanical_press_bottom",
"particle": "create:block/gearbox_top"
}, },
"display": { "display": {
"gui": { "gui": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:coal_ore"
}
],
"results": [
{
"item": "minecraft:coal",
"count": 2
},
{
"item": "minecraft:coal",
"count": 2,
"chance": 0.5
},
{
"item": "minecraft:cobblestone",
"count": 1,
"chance": 0.125
}
],
"processingTime": 300
}

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:diamond_ore"
}
],
"results": [
{
"item": "minecraft:diamond",
"count": 2
},
{
"item": "minecraft:diamond",
"count": 1,
"chance": 0.25
},
{
"item": "minecraft:cobblestone",
"count": 1,
"chance": 0.125
}
],
"processingTime": 500
}

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:emerald_ore"
}
],
"results": [
{
"item": "minecraft:emerald",
"count": 2
},
{
"item": "minecraft:emerald",
"count": 1,
"chance": 0.25
},
{
"item": "minecraft:cobblestone",
"count": 1,
"chance": 0.125
}
],
"processingTime": 500
}

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:gold_ore"
}
],
"results": [
{
"item": "minecraft:gold_ingot",
"count": 1
},
{
"item": "minecraft:gold_nugget",
"count": 9,
"chance": 0.5
},
{
"item": "minecraft:cobblestone",
"count": 1,
"chance": 0.125
}
],
"processingTime": 350
}

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:iron_ore"
}
],
"results": [
{
"item": "minecraft:iron_ingot",
"count": 1
},
{
"item": "minecraft:iron_nugget",
"count": 9,
"chance": 0.5
},
{
"item": "minecraft:cobblestone",
"count": 1,
"chance": 0.125
}
],
"processingTime": 400
}

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:lapis_ore"
}
],
"results": [
{
"item": "minecraft:lapis_lazuli",
"count": 12
},
{
"item": "minecraft:lapis_lazuli",
"count": 8,
"chance": 0.25
},
{
"item": "minecraft:cobblestone",
"count": 1,
"chance": 0.125
}
],
"processingTime": 300
}

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:nether_quartz_ore"
}
],
"results": [
{
"item": "minecraft:quartz",
"count": 2
},
{
"item": "minecraft:quartz",
"count": 4,
"chance": 0.5
},
{
"item": "minecraft:netherrack",
"count": 1,
"chance": 0.125
}
],
"processingTime": 350
}

View file

@ -0,0 +1,26 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:redstone_ore"
}
],
"results": [
{
"item": "minecraft:redstone",
"count": 8
},
{
"item": "minecraft:redstone",
"count": 6,
"chance": 0.25
},
{
"item": "minecraft:cobblestone",
"count": 1,
"chance": 0.125
}
],
"processingTime": 300
}

View file

@ -0,0 +1,16 @@
{
"type": "create:crushing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:terracotta"
}
],
"results": [
{
"item": "minecraft:red_sand",
"count": 1
}
],
"processingTime": 200
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:black_concrete_powder"
}
],
"results": [
{
"item": "minecraft:black_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:blue_concrete_powder"
}
],
"results": [
{
"item": "minecraft:blue_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:brown_concrete_powder"
}
],
"results": [
{
"item": "minecraft:brown_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:bucket"
}
],
"results": [
{
"item": "minecraft:water_bucket",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:cyan_concrete_powder"
}
],
"results": [
{
"item": "minecraft:cyan_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,22 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:gravel"
}
],
"results": [
{
"item": "minecraft:flint",
"count": 1,
"chance": 0.5
},
{
"item": "minecraft:iron_nugget",
"count": 4,
"chance": 0.125
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:gray_concrete_powder"
}
],
"results": [
{
"item": "minecraft:gray_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:green_concrete_powder"
}
],
"results": [
{
"item": "minecraft:green_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:ice"
}
],
"results": [
{
"item": "minecraft:packed_ice",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:light_blue_concrete_powder"
}
],
"results": [
{
"item": "minecraft:light_blue_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:light_gray_concrete_powder"
}
],
"results": [
{
"item": "minecraft:light_gray_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:lime_concrete_powder"
}
],
"results": [
{
"item": "minecraft:lime_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:magenta_concrete_powder"
}
],
"results": [
{
"item": "minecraft:magenta_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:magma_block"
}
],
"results": [
{
"item": "minecraft:obsidian",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:orange_concrete_powder"
}
],
"results": [
{
"item": "minecraft:orange_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:pink_concrete_powder"
}
],
"results": [
{
"item": "minecraft:pink_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:purple_concrete_powder"
}
],
"results": [
{
"item": "minecraft:purple_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:red_concrete_powder"
}
],
"results": [
{
"item": "minecraft:red_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,22 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:red_sand"
}
],
"results": [
{
"item": "minecraft:gold_nugget",
"count": 4,
"chance": 0.125
},
{
"item": "minecraft:dead_bush",
"count": 1,
"chance": 0.05
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:sand"
}
],
"results": [
{
"item": "minecraft:clay_ball",
"count": 2
}
],
"processingTime": 100
}

View file

@ -0,0 +1,22 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:soul_sand"
}
],
"results": [
{
"item": "minecraft:quartz",
"count": 4,
"chance": 0.125
},
{
"item": "minecraft:gold_nugget",
"count": 1,
"chance": 0.02
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:white_concrete_powder"
}
],
"results": [
{
"item": "minecraft:white_concrete",
"count": 1
}
],
"processingTime": 100
}

View file

@ -0,0 +1,16 @@
{
"type": "create:splashing",
"group": "minecraft:misc",
"ingredients": [
{
"item": "minecraft:yellow_concrete_powder"
}
],
"results": [
{
"item": "minecraft:yellow_concrete",
"count": 1
}
],
"processingTime": 100
}