mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Close Call
- Fixed belt splicing not using or refunding belt connectors - Fixed server crash when opening toolbox
This commit is contained in:
parent
0bc26ac7b0
commit
3e1312e695
3 changed files with 27 additions and 13 deletions
|
@ -160,17 +160,27 @@ public class BeltSlicer {
|
|||
requiredShafts++;
|
||||
|
||||
int amountRetrieved = 0;
|
||||
boolean beltFound = false;
|
||||
Search: while (true) {
|
||||
for (int i = 0; i < player.inventory.getContainerSize(); ++i) {
|
||||
if (amountRetrieved == requiredShafts)
|
||||
if (amountRetrieved == requiredShafts && beltFound)
|
||||
break Search;
|
||||
|
||||
ItemStack itemstack = player.inventory.getItem(i);
|
||||
if (itemstack.isEmpty())
|
||||
continue;
|
||||
int count = itemstack.getCount();
|
||||
|
||||
if (AllItems.BELT_CONNECTOR.isIn(itemstack)) {
|
||||
if (!world.isClientSide)
|
||||
itemstack.shrink(1);
|
||||
beltFound = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (AllBlocks.SHAFT.isIn(itemstack)) {
|
||||
int taken = Math.min(count, requiredShafts - amountRetrieved);
|
||||
if (!world.isClientSide)
|
||||
if (taken == count)
|
||||
player.inventory.setItem(i, ItemStack.EMPTY);
|
||||
else
|
||||
|
@ -179,6 +189,7 @@ public class BeltSlicer {
|
|||
}
|
||||
}
|
||||
|
||||
if (!world.isClientSide)
|
||||
player.inventory.placeItemBackInInventory(world, AllBlocks.SHAFT.asStack(amountRetrieved));
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
@ -333,8 +344,10 @@ public class BeltSlicer {
|
|||
state.setValue(BeltBlock.CASING, segmentTE != null && segmentTE.casing != CasingType.NONE)
|
||||
.setValue(BeltBlock.PART, BeltPart.MIDDLE));
|
||||
|
||||
if (!creative)
|
||||
if (!creative) {
|
||||
player.inventory.placeItemBackInInventory(world, AllBlocks.SHAFT.asStack(2));
|
||||
player.inventory.placeItemBackInInventory(world, AllItems.BELT_CONNECTOR.asStack());
|
||||
}
|
||||
|
||||
// Transfer items to other controller
|
||||
BlockPos search = controllerTE.getBlockPos();
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.util.SoundEvents;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
@ -366,9 +367,9 @@ public class ToolboxTileEntity extends SmartTileEntity implements INamedContaine
|
|||
@Override
|
||||
public ITextComponent getDisplayName() {
|
||||
return customName != null ? customName
|
||||
: AllBlocks.TOOLBOXES.get(getColor())
|
||||
: new TranslationTextComponent(AllBlocks.TOOLBOXES.get(getColor())
|
||||
.get()
|
||||
.getName();
|
||||
.getDescriptionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -126,7 +126,7 @@ public class ClientEvents {
|
|||
// ScreenOpener.tick();
|
||||
ServerSpeedProvider.clientTick();
|
||||
BeltConnectorHandler.tick();
|
||||
BeltSlicer.tickHoveringInformation();
|
||||
// BeltSlicer.tickHoveringInformation();
|
||||
FilteringRenderer.tick();
|
||||
LinkRenderer.tick();
|
||||
ScrollValueRenderer.tick();
|
||||
|
|
Loading…
Reference in a new issue