Deployer dupes

- Fixed blazing sword taking damage in the nether
- Fixed blazing sword not igniting entities
- More safety checks
- Fixed stack overflow when overpowering a RSC from both inputs
- Fixed outrageous duplication glitch in deployer item handler
- Fixed crafters not able to return multiple buckets
- Super glue can now be used to make chassis sticky
This commit is contained in:
simibubi 2020-05-09 14:27:09 +02:00
parent 0bd3a8d880
commit 0a869190b2
12 changed files with 84 additions and 20 deletions

View file

@ -26,6 +26,7 @@ import com.simibubi.create.modules.curiosities.ShadowSteelItem;
import com.simibubi.create.modules.curiosities.deforester.DeforesterItem; import com.simibubi.create.modules.curiosities.deforester.DeforesterItem;
import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem; import com.simibubi.create.modules.curiosities.symmetry.SymmetryWandItem;
import com.simibubi.create.modules.curiosities.tools.AllToolTiers; import com.simibubi.create.modules.curiosities.tools.AllToolTiers;
import com.simibubi.create.modules.curiosities.tools.BlazingSwordItem;
import com.simibubi.create.modules.curiosities.tools.BlazingToolItem; import com.simibubi.create.modules.curiosities.tools.BlazingToolItem;
import com.simibubi.create.modules.curiosities.tools.RoseQuartzToolItem; import com.simibubi.create.modules.curiosities.tools.RoseQuartzToolItem;
import com.simibubi.create.modules.curiosities.tools.SandPaperItem; import com.simibubi.create.modules.curiosities.tools.SandPaperItem;
@ -119,7 +120,7 @@ public enum AllItems {
BLAZING_PICKAXE(p -> new BlazingToolItem(1, -2.8F, p, PICKAXE)), BLAZING_PICKAXE(p -> new BlazingToolItem(1, -2.8F, p, PICKAXE)),
BLAZING_SHOVEL(p -> new BlazingToolItem(1.5F, -3.0F, p, SHOVEL)), BLAZING_SHOVEL(p -> new BlazingToolItem(1.5F, -3.0F, p, SHOVEL)),
BLAZING_AXE(p -> new BlazingToolItem(5.0F, -3.0F, p, AXE)), BLAZING_AXE(p -> new BlazingToolItem(5.0F, -3.0F, p, AXE)),
BLAZING_SWORD(p -> new SwordItem(AllToolTiers.BLAZING, 3, -2.4F, p)), BLAZING_SWORD(p -> new BlazingSwordItem(AllToolTiers.BLAZING, 3, -2.4F, p)),
ROSE_QUARTZ_PICKAXE(p -> new RoseQuartzToolItem(1, -2.8F, p, PICKAXE)), ROSE_QUARTZ_PICKAXE(p -> new RoseQuartzToolItem(1, -2.8F, p, PICKAXE)),
ROSE_QUARTZ_SHOVEL(p -> new RoseQuartzToolItem(1.5F, -3.0F, p, SHOVEL)), ROSE_QUARTZ_SHOVEL(p -> new RoseQuartzToolItem(1.5F, -3.0F, p, SHOVEL)),

View file

@ -85,12 +85,15 @@ public class ScreenElementRenderer {
blockRenderer.renderBlockBrightness(blockToRender, 1); blockRenderer.renderBlockBrightness(blockToRender, 1);
} else { } else {
GlStateManager.rotated(90, 0, 1, 0); GlStateManager.rotated(90, 0, 1, 0);
if (modelToRender != null) {
if (color == -1) { if (color == -1) {
blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1); blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, 1, 1, 1);
} else { } else {
Vec3d rgb = ColorHelper.getRGB(color); Vec3d rgb = ColorHelper.getRGB(color);
blockRenderer.getBlockModelRenderer().renderModelBrightnessColor(modelToRender, 1, (float) rgb.x, blockRenderer
(float) rgb.y, (float) rgb.z); .getBlockModelRenderer()
.renderModelBrightnessColor(modelToRender, 1, (float) rgb.x, (float) rgb.y, (float) rgb.z);
}
} }
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();

View file

@ -29,6 +29,7 @@ import net.minecraft.block.AbstractRailBlock;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.CarpetBlock;
import net.minecraft.block.DoorBlock; import net.minecraft.block.DoorBlock;
import net.minecraft.block.FenceGateBlock; import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.FlowerPotBlock; import net.minecraft.block.FlowerPotBlock;
@ -142,6 +143,8 @@ public class BlockMovementTraits {
return true; return true;
if (block instanceof EngineBlock) if (block instanceof EngineBlock)
return true; return true;
if (block instanceof CarpetBlock)
return true;
return false; return false;
} }
@ -168,6 +171,8 @@ public class BlockMovementTraits {
return direction == Direction.DOWN; return direction == Direction.DOWN;
if (block instanceof RedstoneWireBlock) if (block instanceof RedstoneWireBlock)
return direction == Direction.DOWN; return direction == Direction.DOWN;
if (block instanceof CarpetBlock)
return direction == Direction.DOWN;
if (block instanceof RedstoneWallTorchBlock) if (block instanceof RedstoneWallTorchBlock)
return state.get(RedstoneWallTorchBlock.FACING) == direction.getOpposite(); return state.get(RedstoneWallTorchBlock.FACING) == direction.getOpposite();
if (block instanceof TorchBlock) if (block instanceof TorchBlock)

View file

@ -1,5 +1,6 @@
package com.simibubi.create.modules.contraptions.components.contraptions.chassis; package com.simibubi.create.modules.contraptions.components.contraptions.chassis;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllSoundEvents;
import com.simibubi.create.modules.contraptions.IWrenchable; import com.simibubi.create.modules.contraptions.IWrenchable;
@ -45,7 +46,7 @@ public abstract class AbstractChassisBlock extends RotatedPillarBlock implements
return false; return false;
ItemStack heldItem = player.getHeldItem(handIn); ItemStack heldItem = player.getHeldItem(handIn);
boolean isSlimeBall = heldItem.getItem().isIn(Tags.Items.SLIMEBALLS); boolean isSlimeBall = heldItem.getItem().isIn(Tags.Items.SLIMEBALLS) || AllItems.SUPER_GLUE.typeOf(heldItem);
BooleanProperty affectedSide = getGlueableSide(state, hit.getFace()); BooleanProperty affectedSide = getGlueableSide(state, hit.getFace());
if (affectedSide == null) if (affectedSide == null)

View file

@ -217,10 +217,12 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
}); });
groupedItems = new GroupedItems(result); groupedItems = new GroupedItems(result);
containers.forEach(stack -> { for (int i = 0; i < containers.size(); i++) {
GroupedItems container = new GroupedItems(stack); ItemStack stack = containers.get(i);
GroupedItems container = new GroupedItems();
container.grid.put(Pair.of(i, 0), stack);
container.mergeOnto(groupedItems, Pointing.LEFT); container.mergeOnto(groupedItems, Pointing.LEFT);
}); }
phase = Phase.CRAFTING; phase = Phase.CRAFTING;
countDown = 2000; countDown = 2000;

View file

@ -58,7 +58,8 @@ public class DeployerItemHandler implements IItemHandlerModifiable {
return stack; return stack;
int space = held.getMaxStackSize() - held.getCount(); int space = held.getMaxStackSize() - held.getCount();
ItemStack split = stack.copy().split(space); ItemStack remainder = stack.copy();
ItemStack split = remainder.split(space);
if (space == 0) if (space == 0)
return stack; return stack;
@ -68,7 +69,7 @@ public class DeployerItemHandler implements IItemHandlerModifiable {
set(held); set(held);
} }
return split; return remainder;
} }
@Override @Override

View file

@ -59,10 +59,25 @@ public class SpeedControllerTileEntity extends KineticTileEntity {
boolean targetingController) { boolean targetingController) {
if (!(speedControllerIn instanceof SpeedControllerTileEntity)) if (!(speedControllerIn instanceof SpeedControllerTileEntity))
return 0; return 0;
SpeedControllerTileEntity speedController = (SpeedControllerTileEntity) speedControllerIn;
float speed = speedControllerIn.getTheoreticalSpeed();
float wheelSpeed = cogWheel.getTheoreticalSpeed();
float desiredOutputSpeed = getDesiredOutputSpeed(cogWheel, speedControllerIn, targetingController);
float compareSpeed = targetingController ? speed : wheelSpeed;
if (desiredOutputSpeed >= 0 && compareSpeed >= 0)
return Math.max(desiredOutputSpeed, compareSpeed);
if (desiredOutputSpeed < 0 && compareSpeed < 0)
return Math.min(desiredOutputSpeed, compareSpeed);
return desiredOutputSpeed;
}
public static float getDesiredOutputSpeed(KineticTileEntity cogWheel, KineticTileEntity speedControllerIn,
boolean targetingController) {
SpeedControllerTileEntity speedController = (SpeedControllerTileEntity) speedControllerIn;
float targetSpeed = speedController.targetSpeed.getValue(); float targetSpeed = speedController.targetSpeed.getValue();
float speed = speedControllerIn.getSpeed(); float speed = speedControllerIn.getTheoreticalSpeed();
float wheelSpeed = cogWheel.getTheoreticalSpeed(); float wheelSpeed = cogWheel.getTheoreticalSpeed();
if (targetSpeed == 0) if (targetSpeed == 0)

View file

@ -57,6 +57,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -365,6 +366,9 @@ public class BeltBlock extends HorizontalKineticBlock
@Override @Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos,
ISelectionContext context) { ISelectionContext context) {
if (state.getBlock() != this)
return VoxelShapes.empty();
VoxelShape shape = getShape(state, worldIn, pos, context); VoxelShape shape = getShape(state, worldIn, pos, context);
try { try {
if (context.getEntity() == null) if (context.getEntity() == null)

View file

@ -133,7 +133,10 @@ public class BeltTileEntity extends KineticTileEntity {
TileEntity te = world.getTileEntity(controller); TileEntity te = world.getTileEntity(controller);
if (te == null || !(te instanceof BeltTileEntity)) if (te == null || !(te instanceof BeltTileEntity))
return; return;
IItemHandler handler = ((BeltTileEntity) te).getInventory().createHandlerForSegment(index); BeltInventory inventory = ((BeltTileEntity) te).getInventory();
if (inventory == null)
return;
IItemHandler handler = inventory.createHandlerForSegment(index);
itemHandler = LazyOptional.of(() -> handler); itemHandler = LazyOptional.of(() -> handler);
} }

View file

@ -0,0 +1,26 @@
package com.simibubi.create.modules.curiosities.tools;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
public class BlazingSwordItem extends SwordItem {
public BlazingSwordItem(IItemTier tier, int attackDamageIn, float attackSpeedIn, Properties builder) {
super(tier, attackDamageIn, attackSpeedIn, builder);
}
@Override
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) {
target.setFire(2);
return BlazingToolItem.shouldTakeDamage(attacker.world, stack) ? super.hitEntity(stack, target, attacker)
: true;
}
@Override
public int getBurnTime(ItemStack itemStack) {
return itemStack.getMaxDamage() - itemStack.getDamage() + 1;
}
}

View file

@ -54,7 +54,7 @@ public class BlazingToolItem extends AbstractToolItem {
return shouldTakeDamage(attacker.world, stack) ? super.hitEntity(stack, target, attacker) : true; return shouldTakeDamage(attacker.world, stack) ? super.hitEntity(stack, target, attacker) : true;
} }
protected boolean shouldTakeDamage(World world, ItemStack stack) { static boolean shouldTakeDamage(World world, ItemStack stack) {
return world.getDimension().getType() != DimensionType.THE_NETHER; return world.getDimension().getType() != DimensionType.THE_NETHER;
} }

View file

@ -152,6 +152,9 @@ public class InWorldProcessing {
return null; return null;
List<ItemStack> stacks = process(transported.stack, type, belt.getWorld()); List<ItemStack> stacks = process(transported.stack, type, belt.getWorld());
if (stacks == null)
return null;
List<TransportedItemStack> transportedStacks = new ArrayList<>(); List<TransportedItemStack> transportedStacks = new ArrayList<>();
for (ItemStack additional : stacks) { for (ItemStack additional : stacks) {
TransportedItemStack newTransported = transported.getSimilar(); TransportedItemStack newTransported = transported.getSimilar();