Broken Bearings & World Gen

- Made chassis range visualization a little less obnoxious
- Fixed windmill bearings stopping on chunk reload
- Fixed copper and zinc spawning in increased amounts anywhere outside of the biomes they are supposed to do so
- Introduced a brass ingot mixing recipe
- Fixed redstone links getting power from unloaded links
This commit is contained in:
simibubi 2020-03-28 23:34:26 +01:00
parent 46d54a597c
commit c6867532a3
6 changed files with 63 additions and 8 deletions

View file

@ -55,6 +55,24 @@ public enum AllWorldFeatures {
biome.addFeature(entry.feature.getGenerationStage(), createFeature.get());
}
}
// // Debug contained ore features
// for (Biome biome : ForgeRegistries.BIOMES) {
// Debug.markTemporary();
// System.out.println(biome.getRegistryName().getPath() + " has the following features:");
// for (ConfiguredFeature<?> configuredFeature : biome.getFeatures(Decoration.UNDERGROUND_ORES)) {
// IFeatureConfig config = configuredFeature.config;
// if (!(config instanceof DecoratedFeatureConfig))
// continue;
// DecoratedFeatureConfig decoConf = (DecoratedFeatureConfig) config;
// if (!(decoConf.feature.config instanceof OreFeatureConfig))
// continue;
// OreFeatureConfig oreConf = (OreFeatureConfig) decoConf.feature.config;
// System.out.println(configuredFeature.feature.getRegistryName().getPath());
// System.out.println(oreConf.state.getBlock().getRegistryName().getPath());
// System.out.println("--");
// }
// }
}
public static void fillConfig(ForgeConfigSpec.Builder builder) {

View file

@ -28,7 +28,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
protected ConfigInt maxHeight;
private Block block;
private Biome.Category biomeWhitelist;
private Biome.Category specificCategory;
public OreFeature(Block block, int clusterSize) {
this.block = block;
@ -47,7 +47,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
}
public OreFeature<T> inBiomes(Biome.Category category) {
biomeWhitelist = category;
specificCategory = category;
return this;
}
@ -58,7 +58,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
@Override
public Optional<ConfiguredFeature<?>> createFeature(Biome biome) {
if (biomeWhitelist != null && biome.getCategory() == biomeWhitelist)
if (specificCategory != null && biome.getCategory() != specificCategory)
return Optional.empty();
if (!canGenerate())
return Optional.empty();

View file

@ -109,7 +109,7 @@ public class ChassisRangeDisplay {
boolean ctrl = AllKeys.ctrlDown();
ChassisTileEntity chassisTileEntity = (ChassisTileEntity) tileEntity;
if (ctrl) {
GroupEntry existingGroupForPos = getExistingGroupForPos(pos);
if (existingGroupForPos != null) {
@ -119,7 +119,7 @@ public class ChassisRangeDisplay {
return;
}
}
if (!entries.containsKey(pos) || ctrl)
display(chassisTileEntity);
else {
@ -196,9 +196,11 @@ public class ChassisRangeDisplay {
float alpha = timer > 20 ? .5f : timer / 40f;
GlStateManager.color4f(1, .7f, 0, alpha);
Set<BlockPos> includedPositions = entry.includedPositions;
GlStateManager.depthMask(false);
for (BlockPos pos : includedPositions)
TessellatorHelper.cube(Tessellator.getInstance().getBuffer(), pos, size, 1 / 1024f, true, false);
TessellatorHelper.cube(Tessellator.getInstance().getBuffer(), pos, size, 1 / 16f - 1 / 64f, true, false);
TessellatorHelper.draw();
GlStateManager.depthMask(true);
}
private static GroupEntry getExistingGroupForPos(BlockPos pos) {

View file

@ -34,6 +34,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
protected boolean assembleNextTick;
protected float clientAngleDiff;
protected ScrollOptionBehaviour<RotationMode> movementMode;
protected float lastGeneratedSpeed;
public MechanicalBearingTileEntity() {
super(AllTileEntities.MECHANICAL_BEARING.type);
@ -92,7 +93,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
if (!running || !isWindmill)
return 0;
if (movedContraption == null)
return 0;
return lastGeneratedSpeed;
int sails = ((BearingContraption) movedContraption.getContraption()).getSailBlocks() / 8;
return MathHelper.clamp(sails, 1, 16);
}
@ -102,6 +103,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
tag.putBoolean("Running", running);
tag.putBoolean("Windmill", isWindmill);
tag.putFloat("Angle", angle);
tag.putFloat("LastGenerated", lastGeneratedSpeed);
return super.write(tag);
}
@ -110,6 +112,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
running = tag.getBoolean("Running");
isWindmill = tag.getBoolean("Windmill");
angle = tag.getFloat("Angle");
lastGeneratedSpeed = tag.getFloat("LastGenerated");
super.read(tag);
}
@ -169,6 +172,12 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity imp
sendData();
updateGeneratedRotation();
}
@Override
public void updateGeneratedRotation() {
super.updateGeneratedRotation();
lastGeneratedSpeed = getGeneratedSpeed();
}
public void disassemble() {
if (!running)

View file

@ -16,6 +16,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public class RedstoneLinkNetworkHandler {
@ -93,7 +94,12 @@ public class RedstoneLinkNetworkHandler {
iterator.remove();
continue;
}
if (actor.getWorld().getTileEntity(other.tileEntity.getPos()) != other.tileEntity) {
World world = actor.getWorld();
if (world.isBlockPresent(other.tileEntity.getPos())) {
iterator.remove();
continue;
}
if (world.getTileEntity(other.tileEntity.getPos()) != other.tileEntity) {
iterator.remove();
continue;
}

View file

@ -0,0 +1,20 @@
{
"type": "create:mixing",
"ingredients": [
{
"tag": "forge:ingots/copper"
},
{
"tag": "forge:ingots/zinc"
},
{
"item": "minecraft:blaze_powder"
}
],
"results": [
{
"item": "create:brass_ingot",
"count": 2
}
]
}