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

View file

@ -196,9 +196,11 @@ public class ChassisRangeDisplay {
float alpha = timer > 20 ? .5f : timer / 40f; float alpha = timer > 20 ? .5f : timer / 40f;
GlStateManager.color4f(1, .7f, 0, alpha); GlStateManager.color4f(1, .7f, 0, alpha);
Set<BlockPos> includedPositions = entry.includedPositions; Set<BlockPos> includedPositions = entry.includedPositions;
GlStateManager.depthMask(false);
for (BlockPos pos : includedPositions) 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(); TessellatorHelper.draw();
GlStateManager.depthMask(true);
} }
private static GroupEntry getExistingGroupForPos(BlockPos pos) { private static GroupEntry getExistingGroupForPos(BlockPos pos) {

View file

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

View file

@ -16,6 +16,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public class RedstoneLinkNetworkHandler { public class RedstoneLinkNetworkHandler {
@ -93,7 +94,12 @@ public class RedstoneLinkNetworkHandler {
iterator.remove(); iterator.remove();
continue; 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(); iterator.remove();
continue; 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
}
]
}