Merge remote-tracking branch 'origin/master' into fabric-1.16
# Conflicts: # src/main/java/appeng/block/AEBaseBlockItem.java # src/main/java/appeng/core/AEConfig.java # src/main/java/appeng/parts/PartPlacement.java
This commit is contained in:
@@ -122,7 +122,7 @@ public class AEBaseBlockItem extends BlockItem {
|
||||
}
|
||||
|
||||
ActionResult result = super.place(context);
|
||||
if (result != ActionResult.SUCCESS) {
|
||||
if (!result.isAccepted()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class AEBaseBlockItem extends BlockItem {
|
||||
ori = tile;
|
||||
|
||||
if (tile == null) {
|
||||
return ActionResult.SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (ori.canBeRotated() && !this.blockType.hasCustomRotation()) {
|
||||
@@ -148,7 +148,7 @@ public class AEBaseBlockItem extends BlockItem {
|
||||
ori.setOrientation(forward, up);
|
||||
}
|
||||
|
||||
return ActionResult.SUCCESS;
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,9 +159,10 @@ public final class AEConfig {
|
||||
this.matterCannonBattery = commonConfig.matterCannonBattery.get();
|
||||
|
||||
this.featureFlags.clear();
|
||||
|
||||
for (final AEFeature feature : AEFeature.values()) {
|
||||
if (feature.isVisible()) {
|
||||
if (commonConfig.enabledFeatures.containsKey(feature)) {
|
||||
if (feature.isVisible() && feature.isConfig()) {
|
||||
if (commonConfig.enabledFeatures.containsKey(feature) && commonConfig.enabledFeatures.get(feature).get()) {
|
||||
this.featureFlags.add(feature);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
package appeng.core;
|
||||
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.core.api.definitions.ApiBlocks;
|
||||
import appeng.core.api.definitions.ApiItems;
|
||||
@@ -57,17 +54,17 @@ public final class ApiDefinitions implements IDefinitions {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItems items() {
|
||||
public ApiItems items() {
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMaterials materials() {
|
||||
public ApiMaterials materials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IParts parts() {
|
||||
public ApiParts parts() {
|
||||
return parts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.parts;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.parts.*;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
@@ -51,7 +50,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class PartPlacement {
|
||||
|
||||
@@ -215,24 +213,22 @@ public class PartPlacement {
|
||||
host = (IPartHost) tile;
|
||||
}
|
||||
|
||||
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack(1);
|
||||
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
|
||||
final Optional<BlockItem> maybeMultiPartBlockItem = multiPart.maybeBlockItem();
|
||||
ItemStack multiPartStack = multiPart.stack(1);
|
||||
Block multiPartBlock = multiPart.block();
|
||||
BlockItem multiPartBlockItem = multiPart.blockItem();
|
||||
|
||||
final boolean hostIsNotPresent = host == null;
|
||||
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent()
|
||||
&& maybeMultiPartBlockItem.isPresent();
|
||||
BlockState multiPartBlockState = maybeMultiPartBlock.get().getDefaultState();
|
||||
final boolean canMultiPartBePlaced = multiPartBlockState.canPlaceAt(world, te_pos);
|
||||
boolean hostIsNotPresent = host == null;
|
||||
BlockState multiPartBlockState = multiPartBlock.getDefaultState();
|
||||
boolean canMultiPartBePlaced = multiPartBlockState.canPlaceAt(world, te_pos);
|
||||
|
||||
// We cannot override the item stack of normal use context, so we use this hack
|
||||
ItemPlacementContext mpUseCtx = new ItemPlacementContext(
|
||||
new AutomaticItemPlacementContext(world, te_pos, side, maybeMultiPartStack.get(), side));
|
||||
new AutomaticItemPlacementContext(world, te_pos, side, multiPartStack, side));
|
||||
|
||||
// FIXME: This is super-fishy and all needs to be re-checked. what does this
|
||||
// even do???
|
||||
if (hostIsNotPresent && multiPartPresent && canMultiPartBePlaced
|
||||
&& maybeMultiPartBlockItem.get().place(mpUseCtx) == ActionResult.SUCCESS) {
|
||||
if (hostIsNotPresent && canMultiPartBePlaced
|
||||
&& multiPartBlockItem.place(mpUseCtx).isAccepted()) {
|
||||
if (!world.isClient) {
|
||||
tile = world.getBlockEntity(te_pos);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user