Limiting the infinite

- Add new config and tags for better control over infinite draining
behaviour
- Pipes spilling water will now extinguish entities and fires; pipes
spilling lava will now set entities on fire
- Fix some bugs and inconvenient behavior with the config menus
- Fix fluids destroying crushing wheel controllers
- Fix crushing wheel controller using output direction instead of input
direction at times
- Rename blaze burner fuel tags
- Improve GhostBlockRenderer
- Organize imports
- Update Forge
This commit is contained in:
PepperCode1 2022-03-05 01:45:39 -08:00
parent 97ea78e852
commit fa4a0e7261
36 changed files with 353 additions and 308 deletions

View file

@ -6,7 +6,7 @@ org.gradle.daemon = false
# mod version info
mod_version = 0.4d
minecraft_version = 1.18.1
forge_version = 39.0.59
forge_version = 39.1.0
# build dependency versions
forgegradle_version = 5.1.+

View file

@ -2126,7 +2126,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
5049f72c327a88f175f6f9425909e098fc711100 assets/create/sounds.json
5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
613e64b44bed959da899fdd54c1cacb227fb33f2 data/create/advancements/andesite_alloy.json
81885c6bfb85792c88aaa7c9b70f58832945d31f data/create/advancements/andesite_casing.json
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
@ -3339,7 +3339,6 @@ c633372228a13023f9dde2cd3478a7dc90affcea data/create/loot_tables/blocks/crimsite
62800d2baf79e7a45b246896f2679fd6f5082efe data/create/loot_tables/blocks/crimson_window.json
572dfdf4daaaf2c97882f3b2a856737365bf5873 data/create/loot_tables/blocks/crimson_window_pane.json
3503b55a82b94ddaeebbc510eece2cc313c33e43 data/create/loot_tables/blocks/crushing_wheel.json
5c1df8443043b3fe3b665dba348e2ff188bcbe31 data/create/loot_tables/blocks/crushing_wheel_controller.json
252a6476bd2dd730dd97afbf2c69d9627f0d1672 data/create/loot_tables/blocks/cuckoo_clock.json
838c008dc2881fbb4136773b3c84c3d988483f73 data/create/loot_tables/blocks/cut_andesite.json
accd5aecce569330b1821d12f031a68259a42f27 data/create/loot_tables/blocks/cut_andesite_brick_slab.json
@ -5194,8 +5193,10 @@ d063e12c9ef75f39518c6d129ea35d833464d547 data/create/tags/blocks/toolboxes.json
eac71740fb12bdb38b5dfaa2268613d7ba82b809 data/create/tags/blocks/windmill_sails.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/blocks/windowable.json
893a01e6004d6d8272bd1658e98da88bb572ee57 data/create/tags/blocks/wrench_pickup.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/items/blaze_burner_regular_fuel.json
97061ef67cac1fafd869493d06115b968bcb99bf data/create/tags/items/blaze_burner_special_fuel.json
a8bdc387cfa6296ebcc4af14323e2ddb632234dc data/create/tags/fluids/bottomless/allow.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/fluids/bottomless/deny.json
74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/items/blaze_burner_fuel/regular.json
97061ef67cac1fafd869493d06115b968bcb99bf data/create/tags/items/blaze_burner_fuel/special.json
5212172aee2239136c94f9868ad39ec2e17cf1c6 data/create/tags/items/create_ingots.json
4480f211f4a37bfee193eba945bc9f5a8d2c6e34 data/create/tags/items/crushed_ores.json
bce28787b0271382842823d04a977912a88b01c2 data/create/tags/items/sandpaper.json

View file

@ -28,8 +28,8 @@
"trigger": "create:bracket_apply",
"conditions": {
"accepted_entries": [
"create:large_cogwheel",
"create:cogwheel"
"create:cogwheel",
"create:large_cogwheel"
]
}
},

View file

@ -1,20 +0,0 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:air"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"minecraft:water",
"minecraft:lava"
]
}

View file

@ -0,0 +1,4 @@
{
"replace": false,
"values": []
}

View file

@ -399,7 +399,7 @@ public class AllBlocks {
.register();
public static final BlockEntry<BeltBlock> BELT = REGISTRATE.block("belt", BeltBlock::new)
.initialProperties(SharedProperties.beltMaterial, MaterialColor.COLOR_GRAY)
.initialProperties(SharedProperties.BELT_MATERIAL, MaterialColor.COLOR_GRAY)
.properties(p -> p.sound(SoundType.WOOL))
.properties(p -> p.strength(0.8F))
.transform(axeOrPickaxe())
@ -506,7 +506,8 @@ public class AllBlocks {
public static final BlockEntry<CrushingWheelControllerBlock> CRUSHING_WHEEL_CONTROLLER =
REGISTRATE.block("crushing_wheel_controller", CrushingWheelControllerBlock::new)
.initialProperties(() -> Blocks.AIR)
.initialProperties(SharedProperties.CRUSHING_WHEEL_CONTROLLER_MATERIAL)
.properties(p -> p.noOcclusion().noDrops().air())
.blockstate((c, p) -> p.getVariantBuilder(c.get())
.forAllStatesExcept(state -> ConfiguredModel.builder()
.modelFile(p.models()
@ -909,7 +910,7 @@ public class AllBlocks {
.register();
public static final BlockEntry<PulleyBlock.RopeBlock> ROPE = REGISTRATE.block("rope", PulleyBlock.RopeBlock::new)
.initialProperties(SharedProperties.beltMaterial, MaterialColor.COLOR_BROWN)
.initialProperties(SharedProperties.BELT_MATERIAL, MaterialColor.COLOR_BROWN)
.tag(AllBlockTags.BRITTLE.tag)
.properties(p -> p.sound(SoundType.WOOL))
.blockstate((c, p) -> p.simpleBlock(c.get(), p.models()

View file

@ -100,7 +100,7 @@ public class AllItems {
.register();
public static final ItemEntry<CombustibleItem> BLAZE_CAKE = REGISTRATE.item("blaze_cake", CombustibleItem::new)
.tag(AllItemTags.BLAZE_BURNER_SPECIAL_FUEL.tag, AllItemTags.UPRIGHT_ON_BELT.tag)
.tag(AllItemTags.BLAZE_BURNER_FUEL_SPECIAL.tag, AllItemTags.UPRIGHT_ON_BELT.tag)
.onRegister(i -> i.setBurnTime(6400))
.register();

View file

@ -26,6 +26,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.common.Tags;
public class AllTags {
@ -81,7 +82,9 @@ public class AllTags {
public enum NameSpace {
MOD(Create.ID, false, true), FORGE("forge"), TIC("tconstruct")
MOD(Create.ID, false, true),
FORGE("forge"),
TIC("tconstruct")
;
@ -183,8 +186,8 @@ public class AllTags {
public enum AllItemTags {
BLAZE_BURNER_REGULAR_FUEL,
BLAZE_BURNER_SPECIAL_FUEL,
BLAZE_BURNER_FUEL_REGULAR(MOD, "blaze_burner_fuel/regular"),
BLAZE_BURNER_FUEL_SPECIAL(MOD, "blaze_burner_fuel/special"),
CREATE_INGOTS,
CRUSHED_ORES,
SANDPAPER,
@ -255,7 +258,8 @@ public class AllTags {
public enum AllFluidTags {
NO_INFINITE_DRAINING(MOD, true, false),
BOTTOMLESS_ALLOW(MOD, "bottomless/allow"),
BOTTOMLESS_DENY(MOD, "bottomless/deny"),
HONEY(FORGE)
@ -314,12 +318,10 @@ public class AllTags {
.addTag(child));
}
private static void loadClass() {}
}
public static void register() {
AllFluidTags.loadClass();
AllFluidTags.BOTTOMLESS_ALLOW.add(Fluids.WATER, Fluids.LAVA);
AllItemTags.CREATE_INGOTS.includeIn(AllItemTags.BEACON_PAYMENT);
AllItemTags.CREATE_INGOTS.includeIn(Tags.Items.INGOTS);

View file

@ -1,9 +1,42 @@
package com.simibubi.create.compat.jei;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import com.google.common.base.Predicates;
import com.simibubi.create.*;
import com.simibubi.create.compat.jei.category.*;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllFluids;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.Create;
import com.simibubi.create.compat.jei.category.BlockCuttingCategory;
import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe;
import com.simibubi.create.compat.jei.category.CreateRecipeCategory;
import com.simibubi.create.compat.jei.category.CrushingCategory;
import com.simibubi.create.compat.jei.category.DeployingCategory;
import com.simibubi.create.compat.jei.category.FanBlastingCategory;
import com.simibubi.create.compat.jei.category.FanHauntingCategory;
import com.simibubi.create.compat.jei.category.FanSmokingCategory;
import com.simibubi.create.compat.jei.category.FanWashingCategory;
import com.simibubi.create.compat.jei.category.ItemDrainCategory;
import com.simibubi.create.compat.jei.category.MechanicalCraftingCategory;
import com.simibubi.create.compat.jei.category.MillingCategory;
import com.simibubi.create.compat.jei.category.MixingCategory;
import com.simibubi.create.compat.jei.category.MysteriousItemConversionCategory;
import com.simibubi.create.compat.jei.category.PackingCategory;
import com.simibubi.create.compat.jei.category.PolishingCategory;
import com.simibubi.create.compat.jei.category.PressingCategory;
import com.simibubi.create.compat.jei.category.ProcessingViaFanCategory;
import com.simibubi.create.compat.jei.category.SawingCategory;
import com.simibubi.create.compat.jei.category.SequencedAssemblyCategory;
import com.simibubi.create.compat.jei.category.SpoutCategory;
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe;
import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe;
import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity;
@ -23,27 +56,24 @@ import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.VanillaRecipeCategoryUid;
import mezz.jei.api.registration.*;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeCategoryRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.registration.IRecipeTransferRegistration;
import mezz.jei.api.registration.ISubtypeRegistration;
import mezz.jei.api.runtime.IIngredientManager;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.*;
import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.common.crafting.IShapedRecipe;
import net.minecraftforge.fml.ModList;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@JeiPlugin
@SuppressWarnings("unused")
public class CreateJEI implements IModPlugin {

View file

@ -27,7 +27,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraftforge.common.crafting.IShapedRecipe;
public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRecipe> {

View file

@ -81,7 +81,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
if (blockState == null)
return false;
Direction direction = blockState.getValue(CrushingWheelControllerBlock.FACING);
return direction == Direction.DOWN || direction == side;
return direction == Direction.DOWN || direction.getOpposite() == side;
}
@Override
@ -144,21 +144,21 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
inventory.remainingTime = 0;
// Output Items
if (facing.getAxis()
.isHorizontal() || facing == Direction.DOWN) {
if (facing != Direction.UP) {
Direction inputDir = facing.getOpposite();
BlockPos nextPos = worldPosition.offset(facing.getAxis() == Axis.X ? 1f * offset : 0f, (-1f),
facing.getAxis() == Axis.Z ? 1f * offset : 0f);
DirectBeltInputBehaviour behaviour =
TileEntityBehaviour.get(level, nextPos, DirectBeltInputBehaviour.TYPE);
if (behaviour != null) {
boolean changed = false;
if (!behaviour.canInsertFromSide(facing))
if (!behaviour.canInsertFromSide(inputDir))
return;
for (int slot = 0; slot < inventory.getSlots(); slot++) {
ItemStack stack = inventory.getStackInSlot(slot);
if (stack.isEmpty())
continue;
ItemStack remainder = behaviour.handleInsertion(stack, facing, false);
ItemStack remainder = behaviour.handleInsertion(stack, inputDir, false);
if (remainder.equals(stack, false))
continue;
inventory.setStackInSlot(slot, remainder);

View file

@ -34,7 +34,6 @@ import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;

View file

@ -103,7 +103,7 @@ public class SuperGlueHandler {
if (!world.isClientSide) {
entity.playPlaceSound();
world.addFreshEntity(entity);
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(() -> entity),
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> entity),
new GlueEffectPacket(ray.getBlockPos(), face, true));
}
itemstack.hurtAndBreak(1, placer, SuperGlueItem::onBroken);

View file

@ -20,14 +20,18 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.AbstractCandleBlock;
import net.minecraft.world.level.block.CampfireBlock;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
@ -46,6 +50,8 @@ public class OpenEndedPipe extends FlowSource {
static {
registerEffectHandler(new PotionEffectHandler());
registerEffectHandler(new MilkEffectHandler());
registerEffectHandler(new WaterEffectHandler());
registerEffectHandler(new LavaEffectHandler());
}
private Level world;
@ -348,15 +354,15 @@ public class OpenEndedPipe extends FlowSource {
if (pipe.cachedEffects.isEmpty())
return;
List<LivingEntity> list =
List<LivingEntity> entities =
pipe.getWorld().getEntitiesOfClass(LivingEntity.class, pipe.getAOE(), LivingEntity::isAffectedByPotions);
for (LivingEntity livingentity : list) {
for (MobEffectInstance effectinstance : pipe.cachedEffects) {
MobEffect effect = effectinstance.getEffect();
for (LivingEntity entity : entities) {
for (MobEffectInstance effectInstance : pipe.cachedEffects) {
MobEffect effect = effectInstance.getEffect();
if (effect.isInstantenous()) {
effect.applyInstantenousEffect(null, null, livingentity, effectinstance.getAmplifier(), 0.5D);
effect.applyInstantenousEffect(null, null, entity, effectInstance.getAmplifier(), 0.5D);
} else {
livingentity.addEffect(new MobEffectInstance(effectinstance));
entity.addEffect(new MobEffectInstance(effectInstance));
}
}
}
@ -366,7 +372,7 @@ public class OpenEndedPipe extends FlowSource {
public static class MilkEffectHandler implements IEffectHandler {
@Override
public boolean canApplyEffects(OpenEndedPipe pipe, FluidStack fluid) {
return Tags.Fluids.MILK.contains(fluid.getFluid());
return fluid.getFluid().is(Tags.Fluids.MILK);
}
@Override
@ -374,11 +380,60 @@ public class OpenEndedPipe extends FlowSource {
Level world = pipe.getWorld();
if (world.getGameTime() % 5 != 0)
return;
List<LivingEntity> list =
List<LivingEntity> entities =
world.getEntitiesOfClass(LivingEntity.class, pipe.getAOE(), LivingEntity::isAffectedByPotions);
ItemStack curativeItem = new ItemStack(Items.MILK_BUCKET);
for (LivingEntity livingentity : list)
livingentity.curePotionEffects(curativeItem);
for (LivingEntity entity : entities)
entity.curePotionEffects(curativeItem);
}
}
public static class WaterEffectHandler implements IEffectHandler {
@Override
public boolean canApplyEffects(OpenEndedPipe pipe, FluidStack fluid) {
return fluid.getFluid().is(FluidTags.WATER);
}
@Override
public void applyEffects(OpenEndedPipe pipe, FluidStack fluid) {
Level world = pipe.getWorld();
if (world.getGameTime() % 5 != 0)
return;
List<Entity> entities = world.getEntities((Entity) null, pipe.getAOE(), Entity::isOnFire);
for (Entity entity : entities)
entity.clearFire();
BlockPos.betweenClosedStream(pipe.getAOE()).forEach(pos -> dowseFire(world, pos));
}
// Adapted from ThrownPotion
private static void dowseFire(Level level, BlockPos pos) {
BlockState state = level.getBlockState(pos);
if (state.is(BlockTags.FIRE)) {
level.removeBlock(pos, false);
} else if (AbstractCandleBlock.isLit(state)) {
AbstractCandleBlock.extinguish(null, state, level, pos);
} else if (CampfireBlock.isLitCampfire(state)) {
level.levelEvent(null, 1009, pos, 0);
CampfireBlock.dowse(null, level, pos, state);
level.setBlockAndUpdate(pos, state.setValue(CampfireBlock.LIT, false));
}
}
}
public static class LavaEffectHandler implements IEffectHandler {
@Override
public boolean canApplyEffects(OpenEndedPipe pipe, FluidStack fluid) {
return fluid.getFluid().is(FluidTags.LAVA);
}
@Override
public void applyEffects(OpenEndedPipe pipe, FluidStack fluid) {
Level world = pipe.getWorld();
if (world.getGameTime() % 5 != 0)
return;
List<Entity> entities = world.getEntities((Entity) null, pipe.getAOE(), entity -> !entity.fireImmune());
for (Entity entity : entities)
entity.setSecondsOnFire(3);
}
}

View file

@ -5,8 +5,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
import com.simibubi.create.AllTags;
import com.simibubi.create.AllTags.AllFluidTags;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.fluid.FluidHelper;
import com.simibubi.create.foundation.networking.AllPackets;
@ -212,7 +213,7 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
}
protected boolean canDrainInfinitely(Fluid fluid) {
return maxBlocks() != -1 && !AllTags.AllFluidTags.NO_INFINITE_DRAINING.matches(fluid);
return maxBlocks() != -1 && AllConfigs.SERVER.fluids.bottomlessFluidMode.get().test(fluid);
}
@Override
@ -238,4 +239,31 @@ public abstract class FluidManipulationBehaviour extends TileEntityBehaviour {
super.read(nbt, clientPacket);
}
public enum BottomlessFluidMode implements Predicate<Fluid> {
ALLOW_ALL {
@Override
public boolean test(Fluid fluid) {
return true;
}
},
DENY_ALL {
@Override
public boolean test(Fluid fluid) {
return false;
}
},
ALLOW_BY_TAG {
@Override
public boolean test(Fluid fluid) {
return AllFluidTags.BOTTOMLESS_ALLOW.matches(fluid);
}
},
DENY_BY_TAG {
@Override
public boolean test(Fluid fluid) {
return !AllFluidTags.BOTTOMLESS_DENY.matches(fluid);
}
};
}
}

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.contraptions.particle;
import javax.annotation.Nonnull;
import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.components.fan.IAirCurrentSource;
import com.simibubi.create.content.contraptions.processing.InWorldProcessing;
@ -7,7 +9,11 @@ import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.*;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.ParticleRenderType;
import net.minecraft.client.particle.SimpleAnimatedParticle;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.BlockParticleOption;
@ -17,8 +23,6 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.phys.Vec3;
import javax.annotation.Nonnull;
public class AirFlowParticle extends SimpleAnimatedParticle {
private final IAirCurrentSource source;

View file

@ -170,14 +170,14 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
FuelType newFuel = FuelType.NONE;
int newBurnTime;
if (AllItemTags.BLAZE_BURNER_SPECIAL_FUEL.matches(itemStack)) {
if (AllItemTags.BLAZE_BURNER_FUEL_SPECIAL.matches(itemStack)) {
newBurnTime = 1000;
newFuel = FuelType.SPECIAL;
} else {
newBurnTime = ForgeHooks.getBurnTime(itemStack, null);
if (newBurnTime > 0)
newFuel = FuelType.NORMAL;
else if (AllItemTags.BLAZE_BURNER_REGULAR_FUEL.matches(itemStack)) {
else if (AllItemTags.BLAZE_BURNER_FUEL_REGULAR.matches(itemStack)) {
newBurnTime = 1600; // Same as coal
newFuel = FuelType.NORMAL;
}

View file

@ -26,7 +26,6 @@ import net.minecraft.world.item.crafting.Ingredient.ItemValue;
import net.minecraft.world.item.crafting.Ingredient.TagValue;
import net.minecraft.world.item.crafting.Ingredient.Value;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.ShapedRecipe;
import net.minecraft.world.level.Level;
import net.minecraftforge.common.crafting.IShapedRecipe;
import net.minecraftforge.common.crafting.MultiItemValue;

View file

@ -593,7 +593,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
}
protected boolean shouldIgnoreBlockState(BlockState state, BlockEntity te) {
// Block doesnt have a mapping (Water, lava, etc)
// Block doesn't have a mapping (Water, lava, etc)
if (state.getBlock() == Blocks.STRUCTURE_VOID)
return true;
@ -603,7 +603,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
if (requirement.isInvalid())
return false;
// Block doesnt need to be placed twice (Doors, beds, double plants)
// Block doesn't need to be placed twice (Doors, beds, double plants)
if (state.hasProperty(BlockStateProperties.DOUBLE_BLOCK_HALF)
&& state.getValue(BlockStateProperties.DOUBLE_BLOCK_HALF) == DoubleBlockHalf.UPPER)
return true;

View file

@ -1,5 +1,7 @@
package com.simibubi.create.foundation.config;
import com.simibubi.create.content.contraptions.fluids.actors.FluidManipulationBehaviour.BottomlessFluidMode;
public class CFluids extends ConfigBase {
public final ConfigInt fluidTankCapacity = i(8, 1, "fluidTankCapacity", Comments.buckets, Comments.fluidTankCapacity);
@ -7,10 +9,12 @@ public class CFluids extends ConfigBase {
public final ConfigInt mechanicalPumpRange =
i(16, 1, "mechanicalPumpRange", Comments.blocks, Comments.mechanicalPumpRange);
public final ConfigInt hosePulleyRange = i(128, 1, "hosePulleyRange", Comments.blocks, Comments.hosePulleyRange);
public final ConfigInt hosePulleyBlockThreshold = i(10000, -1, "hosePulleyBlockThreshold", Comments.blocks,
Comments.toDisable, Comments.hosePulleyBlockThreshold);
public final ConfigBool fillInfinite = b(false, "fillInfinite", Comments.fillInfinite);
public final ConfigInt hosePulleyRange = i(128, 1, "hosePulleyRange", Comments.blocks, Comments.hosePulleyRange);
public final ConfigEnum<BottomlessFluidMode> bottomlessFluidMode = e(BottomlessFluidMode.ALLOW_BY_TAG, "bottomlessFluidMode",
Comments.bottomlessFluidMode);
public ConfigBool placeFluidSourceBlocks = b(true, "placeFluidSourceBlocks", Comments.placeFluidSourceBlocks);
@ -22,17 +26,20 @@ public class CFluids extends ConfigBase {
private static class Comments {
static String blocks = "[in Blocks]";
static String buckets = "[in Buckets]";
static String toDisable = "[-1 to disable this behaviour]";
static String fluidTankCapacity = "The amount of liquid a tank can hold per block.";
static String fluidTankMaxHeight = "The maximum height a fluid tank can reach.";
static String mechanicalPumpRange =
"The maximum distance a mechanical pump can push or pull liquids on either side.";
static String hosePulleyRange = "The maximum distance a hose pulley can draw fluid blocks from.";
static String toDisable = "[-1 to disable this behaviour]";
static String hosePulleyBlockThreshold =
"The minimum amount of fluid blocks the hose pulley needs to find before deeming it an infinite source.";
static String fillInfinite = "Whether hose pulleys should continue filling up above-threshold sources";
static String placeFluidSourceBlocks = "Whether open-ended pipes and hose pulleys should be allowed to place fluid sources";
static String fillInfinite = "Whether hose pulleys should continue filling up above-threshold sources.";
static String bottomlessFluidMode = "Configure which fluids can be drained infinitely.";
static String placeFluidSourceBlocks = "Whether open-ended pipes and hose pulleys should be allowed to place fluid sources.";
}
}

View file

@ -8,6 +8,8 @@ import java.util.function.UnaryOperator;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.config.AllConfigs;
@ -144,7 +146,7 @@ public class BaseConfigScreen extends ConfigScreen {
super.init();
returnOnClose = true;
TextStencilElement clientText = new TextStencilElement(minecraft.font, new TextComponent(clientTile)).centered(true, true);
TextStencilElement clientText = new TextStencilElement(font, new TextComponent(clientTile)).centered(true, true);
addRenderableWidget(clientConfigWidget = new BoxWidget(width / 2 - 100, height / 2 - 15 - 30, 200, 16).showingElement(clientText));
if (clientSpec != null) {
@ -156,7 +158,7 @@ public class BaseConfigScreen extends ConfigScreen {
clientText.withElementRenderer(DISABLED_RENDERER);
}
TextStencilElement commonText = new TextStencilElement(minecraft.font, new TextComponent(commonTile)).centered(true, true);
TextStencilElement commonText = new TextStencilElement(font, new TextComponent(commonTile)).centered(true, true);
addRenderableWidget(commonConfigWidget = new BoxWidget(width / 2 - 100, height / 2 - 15, 200, 16).showingElement(commonText));
if (commonSpec != null) {
@ -168,7 +170,7 @@ public class BaseConfigScreen extends ConfigScreen {
commonText.withElementRenderer(DISABLED_RENDERER);
}
TextStencilElement serverText = new TextStencilElement(minecraft.font, new TextComponent(serverTile)).centered(true, true);
TextStencilElement serverText = new TextStencilElement(font, new TextComponent(serverTile)).centered(true, true);
addRenderableWidget(serverConfigWidget = new BoxWidget(width / 2 - 100, height / 2 - 15 + 30, 200, 16).showingElement(serverText));
if (serverSpec == null) {
@ -189,7 +191,7 @@ public class BaseConfigScreen extends ConfigScreen {
serverText.withElementRenderer(BoxWidget.gradientFactory.apply(serverConfigWidget));
}
TextStencilElement titleText = new TextStencilElement(minecraft.font, modID.toUpperCase(Locale.ROOT))
TextStencilElement titleText = new TextStencilElement(font, modID.toUpperCase(Locale.ROOT))
.centered(true, true)
.withElementRenderer((ms, w, h, alpha) -> {
UIRenderHelper.angledGradient(ms, 0, 0, h / 2, h, w / 2, Theme.p(Theme.Key.CONFIG_TITLE_A));
@ -212,24 +214,23 @@ public class BaseConfigScreen extends ConfigScreen {
ConfigScreen.modID = this.modID;
goBack = new BoxWidget(width / 2 - 134, height / 2, 20, 20).withPadding(2, 2)
.withCallback(this::onClose);
.withCallback(() -> linkTo(parent));
goBack.showingElement(AllIcons.I_CONFIG_BACK.asStencil()
.withElementRenderer(BoxWidget.gradientFactory.apply(goBack)));
goBack.getToolTip()
.add(new TextComponent("Go Back"));
addRenderableWidget(goBack);
TextStencilElement othersText = new TextStencilElement(minecraft.font, new TextComponent("Access Configs of other Mods")).centered(true, true);
TextStencilElement othersText = new TextStencilElement(font, new TextComponent("Access Configs of other Mods")).centered(true, true);
others = new BoxWidget(width / 2 - 100, height / 2 - 15 + 90, 200, 16).showingElement(othersText);
othersText.withElementRenderer(BoxWidget.gradientFactory.apply(others));
others.withCallback(() -> linkTo(new ConfigModListScreen(this)));
addRenderableWidget(others);
}
@Override
protected void renderWindow(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
drawCenteredString(ms, minecraft.font, "Access Configs for Mod:", width / 2, height / 2 - 105, Theme.i(Theme.Key.TEXT_ACCENT_STRONG));
drawCenteredString(ms, font, "Access Configs for Mod:", width / 2, height / 2 - 105, Theme.i(Theme.Key.TEXT_ACCENT_STRONG));
}
private void linkTo(Screen screen) {
@ -238,9 +239,13 @@ public class BaseConfigScreen extends ConfigScreen {
}
@Override
public void onClose() {
super.onClose();
ScreenOpener.open(parent);
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (super.keyPressed(keyCode, scanCode, modifiers))
return true;
if (keyCode == GLFW.GLFW_KEY_BACKSPACE) {
linkTo(parent);
}
return false;
}
}

View file

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.gui.ScreenOpener;
@ -52,7 +54,7 @@ public class ConfigModListScreen extends ConfigScreen {
list.children().addAll(allEntries);
goBack = new BoxWidget(width / 2 - listWidth / 2 - 30, height / 2 + 65, 20, 20).withPadding(2, 2)
.withCallback(this::onClose);
.withCallback(() -> ScreenOpener.open(parent));
goBack.showingElement(AllIcons.I_CONFIG_BACK.asStencil()
.withElementRenderer(BoxWidget.gradientFactory.apply(goBack)));
goBack.getToolTip()
@ -61,16 +63,19 @@ public class ConfigModListScreen extends ConfigScreen {
search = new HintableTextFieldWidget(font, width / 2 - listWidth / 2, height - 35, listWidth, 20);
search.setResponder(this::updateFilter);
search.setHint("Search..");
search.setHint("Search...");
search.moveCursorToStart();
addRenderableWidget(search);
}
@Override
public void onClose() {
super.onClose();
ScreenOpener.open(parent);
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (super.keyPressed(keyCode, scanCode, modifiers))
return true;
if (keyCode == GLFW.GLFW_KEY_BACKSPACE) {
ScreenOpener.open(parent);
}
return false;
}
private void updateFilter(String search) {

View file

@ -34,7 +34,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
/*
*
* TO DO
* TODO
*
* reduce number of packets sent to the server when saving a bunch of values
*
@ -42,7 +42,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
*
* tooltips are hidden underneath the scrollbar, if the bar is near the middle
*
* */
*/
public static final Map<String, TriConsumer<Screen, PoseStack, Float>> backgrounds = new HashMap<>();
public static final PhysicalFloat cogSpin = PhysicalFloat.create().withLimit(10f).withDrag(0.3).addForce(new Force.Static(.2f));
@ -139,7 +139,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
}
float elapsedPartials = minecraft.getDeltaFrameTime();
CreateMainMenuScreen.panorama.render(elapsedPartials, 1);
CreateMainMenuScreen.PANORAMA.render(elapsedPartials, 1);
RenderSystem.setShaderTexture(0, CreateMainMenuScreen.PANORAMA_OVERLAY_TEXTURES);
RenderSystem.enableBlend();

View file

@ -29,7 +29,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
public class OpenCreateMenuButton extends Button {
public static ItemStack icon = AllItems.GOGGLES.asStack();
public static final ItemStack ICON = AllItems.GOGGLES.asStack();
public OpenCreateMenuButton(int x, int y) {
super(x, y, 20, 20, TextComponent.EMPTY, OpenCreateMenuButton::click);
@ -40,7 +40,7 @@ public class OpenCreateMenuButton extends Button {
super.render(mstack, mouseX, mouseY, pticks);
if (!visible)
return;
Minecraft.getInstance().getItemRenderer().renderGuiItem(icon, x + 2, y + 2);
Minecraft.getInstance().getItemRenderer().renderGuiItem(ICON, x + 2, y + 2);
}
public static void click(Button b) {

View file

@ -127,7 +127,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
protected void saveChanges() {
UnmodifiableConfig values = spec.getValues();
ConfigHelper.changes.forEach((path, change) -> {
ForgeConfigSpec.ConfigValue configValue = values.get(path);
ForgeConfigSpec.ConfigValue<Object> configValue = values.get(path);
configValue.set(change.value);
if (type == ModConfig.Type.SERVER) {
@ -147,8 +147,8 @@ public class SubMenuConfigScreen extends ConfigScreen {
values.valueMap().forEach((key, obj) -> {
if (obj instanceof AbstractConfig) {
resetConfig((UnmodifiableConfig) obj);
} else if (obj instanceof ForgeConfigSpec.ConfigValue<?>) {
ForgeConfigSpec.ConfigValue configValue = (ForgeConfigSpec.ConfigValue<?>) obj;
} else if (obj instanceof ForgeConfigSpec.ConfigValue) {
ForgeConfigSpec.ConfigValue<Object> configValue = (ForgeConfigSpec.ConfigValue<Object>) obj;
ForgeConfigSpec.ValueSpec valueSpec = spec.getRaw((List<String>) configValue.getPath());
List<String> comments = new ArrayList<>();
@ -252,7 +252,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
search = new ConfigTextField(font, width / 2 - listWidth / 2, height - 35, listWidth, 20);
search.setResponder(this::updateFilter);
search.setHint("Search..");
search.setHint("Search...");
search.moveCursorToStart();
addRenderableWidget(search);
@ -325,7 +325,6 @@ public class SubMenuConfigScreen extends ConfigScreen {
.withPadding(2, 2)
.showingElement(stencil);
if (!canEdit) {
list.children().forEach(e -> e.setEditable(false));
resetAll.active = false;
@ -375,17 +374,17 @@ public class SubMenuConfigScreen extends ConfigScreen {
}
@Override
public boolean keyPressed(int code, int p_keyPressed_2_, int p_keyPressed_3_) {
if (super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_))
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (super.keyPressed(keyCode, scanCode, modifiers))
return true;
if (Screen.hasControlDown()) {
if (code == GLFW.GLFW_KEY_F) {
if (keyCode == GLFW.GLFW_KEY_F) {
search.setFocus(true);
}
}
if (code == GLFW.GLFW_KEY_BACKSPACE) {
if (keyCode == GLFW.GLFW_KEY_BACKSPACE) {
attemptBackstep();
}
@ -406,36 +405,31 @@ public class SubMenuConfigScreen extends ConfigScreen {
return;
}
Consumer<ConfirmationScreen.Response> action = success -> {
showLeavingPrompt(success -> {
if (success == Response.Cancel)
return;
if (success == Response.Confirm)
saveChanges();
ConfigHelper.changes.clear();
ScreenOpener.open(parent);
};
showLeavingPrompt(action);
});
}
@Override
public void onClose() {
if (ConfigHelper.changes.isEmpty()) {
super.onClose();
ScreenOpener.open(parent);
return;
}
Consumer<ConfirmationScreen.Response> action = success -> {
showLeavingPrompt(success -> {
if (success == Response.Cancel)
return;
if (success == Response.Confirm)
saveChanges();
ConfigHelper.changes.clear();
super.onClose();
};
showLeavingPrompt(action);
});
}
public void showLeavingPrompt(Consumer<ConfirmationScreen.Response> action) {

View file

@ -9,9 +9,12 @@ import net.minecraft.world.level.material.PushReaction;
@MethodsReturnNonnullByDefault
public class SharedProperties {
public static Material beltMaterial =
public static final Material BELT_MATERIAL =
new Material(MaterialColor.COLOR_GRAY, false, true, true, true, false, false, PushReaction.NORMAL);
public static final Material CRUSHING_WHEEL_CONTROLLER_MATERIAL =
new Material(MaterialColor.NONE, false, false, true, true, false, false, PushReaction.BLOCK);
public static Block stone() {
return Blocks.ANDESITE;
}

View file

@ -16,8 +16,6 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.SetTag;

View file

@ -112,6 +112,21 @@ public abstract class AbstractSimiScreen extends Screen {
ms.popPose();
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
boolean keyPressed = super.keyPressed(keyCode, scanCode, modifiers);
if (keyPressed || getFocused() != null)
return keyPressed;
InputConstants.Key mouseKey = InputConstants.getKey(keyCode, scanCode);
if (this.minecraft.options.keyInventory.isActiveAndMatches(mouseKey)) {
this.onClose();
return true;
}
return false;
}
protected void prepareFrame() {
}
@ -138,20 +153,5 @@ public abstract class AbstractSimiScreen extends Screen {
protected void debugWindowArea(PoseStack matrixStack) {
fill(matrixStack, guiLeft + windowWidth, guiTop + windowHeight, guiLeft, guiTop, 0xD3D3D3D3);
}
@Override
public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) {
boolean keyPressed = super.keyPressed(pKeyCode, pScanCode, pModifiers);
if (keyPressed || getFocused() != null)
return keyPressed;
InputConstants.Key mouseKey = InputConstants.getKey(pKeyCode, pScanCode);
if (this.minecraft.options.keyInventory.isActiveAndMatches(mouseKey)) {
this.onClose();
return true;
}
return false;
}
}

View file

@ -99,8 +99,7 @@ public class ConfirmationScreen extends AbstractSimiScreen {
@Override
public void tick() {
super.tick();
confirm.tick();
cancel.tick();
source.tick();
}
@Override
@ -109,9 +108,9 @@ public class ConfirmationScreen extends AbstractSimiScreen {
ArrayList<FormattedText> copy = new ArrayList<>(text);
text.clear();
copy.forEach(t -> text.addAll(minecraft.font.getSplitter().splitLines(t, 300, Style.EMPTY)));
copy.forEach(t -> text.addAll(font.getSplitter().splitLines(t, 300, Style.EMPTY)));
textHeight = text.size() * (minecraft.font.lineHeight + 1) + 4;
textHeight = text.size() * (font.lineHeight + 1) + 4;
textWidth = 300;
if (centered) {
@ -133,7 +132,7 @@ public class ConfirmationScreen extends AbstractSimiScreen {
int buttonX = x + textWidth / 2 - 6 - (int) (70 * (tristate ? 1.5f : 1));
TextStencilElement confirmText =
new TextStencilElement(minecraft.font, tristate ? "Save" : "Confirm").centered(true, true);
new TextStencilElement(font, tristate ? "Save" : "Confirm").centered(true, true);
confirm = new BoxWidget(buttonX, y + textHeight + 6, 70, 16).withCallback(() -> accept(Response.Confirm));
confirm.showingElement(confirmText.withElementRenderer(BoxWidget.gradientFactory.apply(confirm)));
addRenderableWidget(confirm);
@ -142,7 +141,7 @@ public class ConfirmationScreen extends AbstractSimiScreen {
if (tristate) {
TextStencilElement confirmDontSaveText =
new TextStencilElement(minecraft.font, "Don't Save").centered(true, true);
new TextStencilElement(font, "Don't Save").centered(true, true);
confirmDontSave =
new BoxWidget(buttonX, y + textHeight + 6, 70, 16).withCallback(() -> accept(Response.ConfirmDontSave));
confirmDontSave.showingElement(
@ -151,7 +150,7 @@ public class ConfirmationScreen extends AbstractSimiScreen {
buttonX += 12 + 70;
}
TextStencilElement cancelText = new TextStencilElement(minecraft.font, "Cancel").centered(true, true);
TextStencilElement cancelText = new TextStencilElement(font, "Cancel").centered(true, true);
cancel = new BoxWidget(buttonX, y + textHeight + 6, 70, 16)
.withCallback(() -> accept(Response.Cancel));
cancel.showingElement(cancelText.withElementRenderer(BoxWidget.gradientFactory.apply(cancel)));
@ -162,6 +161,8 @@ public class ConfirmationScreen extends AbstractSimiScreen {
.withBounds(width + 10, textHeight + 35)
.at(-5, y - 5);
if (text.size() == 1)
x = (width - font.width(text.get(0))) / 2;
}
@Override
@ -176,26 +177,21 @@ public class ConfirmationScreen extends AbstractSimiScreen {
@Override
protected void renderWindow(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
textBackground.render(ms);
int offset = minecraft.font.lineHeight + 1;
int offset = font.lineHeight + 1;
int lineY = y - offset;
ms.pushPose();
ms.translate(0, 0, 200);
for (FormattedText line : text) {
lineY = lineY + offset;
lineY += offset;
if (line == null)
continue;
int textX = x;
if (text.size() == 1)
x = (width - minecraft.font.width(line)) / 2;
minecraft.font.draw(ms, line.getString(), textX, lineY, 0xeaeaea);
font.draw(ms, line.getString(), x, lineY, 0xeaeaea);
}
ms.popPose();
}
@Override

View file

@ -30,14 +30,18 @@ import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
public class CreateMainMenuScreen extends AbstractSimiScreen {
protected final Screen parent;
protected boolean returnOnClose;
public static final CubeMap PANORAMA_RESOURCES =
new CubeMap(Create.asResource("textures/gui/title/background/panorama"));
public static final ResourceLocation PANORAMA_OVERLAY_TEXTURES =
new ResourceLocation("textures/gui/title/background/panorama_overlay.png");
public static PanoramaRenderer panorama = new PanoramaRenderer(PANORAMA_RESOURCES);
public static final PanoramaRenderer PANORAMA = new PanoramaRenderer(PANORAMA_RESOURCES);
public static final String PROJECT_LINK = "https://www.curseforge.com/minecraft/mc-mods/create";
public static final String ISSUE_TRACKER_LINK = "https://github.com/Creators-of-Create/Create/issues";
public static final String SUPPORT_LINK = "https://github.com/Creators-of-Create/Create/wiki/Supporting-the-Project";
protected final Screen parent;
protected boolean returnOnClose;
private PanoramaRenderer vanillaPanorama;
private long firstRenderTime;
@ -69,7 +73,7 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
if (parent instanceof TitleScreen) {
if (alpha < 1)
vanillaPanorama.render(elapsedPartials, 1);
panorama.render(elapsedPartials, alpha);
PANORAMA.render(elapsedPartials, alpha);
RenderSystem.setShaderTexture(0, PANORAMA_OVERLAY_TEXTURES);
RenderSystem.enableBlend();
@ -115,7 +119,7 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
drawCenteredString(ms, font, new TextComponent(Create.NAME).withStyle(ChatFormatting.BOLD)
.append(
new TextComponent(" v" + Create.VERSION).withStyle(ChatFormatting.BOLD, ChatFormatting.WHITE)),
width / 2, 89, 0xff_E4BB67);
width / 2, 89, 0xFF_E4BB67);
ms.popPose();
RenderSystem.disableDepthTest();
@ -128,14 +132,14 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
}
private void addButtons() {
int yStart = height / 4 + (parent instanceof TitleScreen ? 40 : 40);
int yStart = height / 4 + 40;
int center = width / 2;
int bHeight = 20;
int bShortWidth = 98;
int bLongWidth = 200;
addRenderableWidget(
new Button(center - 100, yStart + 92, bLongWidth, bHeight, Lang.translate("menu.return"), $ -> onClose()));
new Button(center - 100, yStart + 92, bLongWidth, bHeight, Lang.translate("menu.return"), $ -> linkTo(parent)));
addRenderableWidget(new Button(center - 100, yStart + 24 + -16, bLongWidth, bHeight, Lang.translate("menu.configure"),
$ -> linkTo(BaseConfigScreen.forCreate(this))));
@ -144,16 +148,12 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
gettingStarted.active = !(parent instanceof TitleScreen);
addRenderableWidget(gettingStarted);
String projectLink = "https://www.curseforge.com/minecraft/mc-mods/create";
String issueTrackerLink = "https://github.com/Creators-of-Create/Create/issues";
String supportLink = "https://github.com/Creators-of-Create/Create/wiki/Supporting-the-Project";
addRenderableWidget(new Button(center - 100, yStart + 48 + -16, bShortWidth, bHeight, Lang.translate("menu.project_page"),
$ -> linkTo(projectLink)));
$ -> linkTo(PROJECT_LINK)));
addRenderableWidget(new Button(center + 2, yStart + 68, bShortWidth, bHeight, Lang.translate("menu.report_bugs"),
$ -> linkTo(issueTrackerLink)));
$ -> linkTo(ISSUE_TRACKER_LINK)));
addRenderableWidget(new Button(center - 100, yStart + 68, bShortWidth, bHeight, Lang.translate("menu.support"),
$ -> linkTo(supportLink)));
$ -> linkTo(SUPPORT_LINK)));
}
@Override
@ -171,10 +171,6 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
}
}
public void tick() {
super.tick();
}
private void linkTo(Screen screen) {
returnOnClose = false;
ScreenOpener.open(screen);
@ -195,10 +191,4 @@ public class CreateMainMenuScreen extends AbstractSimiScreen {
return true;
}
@Override
public void onClose() {
super.onClose();
ScreenOpener.open(parent);
}
}

View file

@ -16,7 +16,7 @@ import com.simibubi.create.foundation.utility.Couple;
public class Theme {
private static final List<Theme> THEMES = new ArrayList<>();
private static final Theme BASE = addTheme(new Theme());
public static final Theme BASE = addTheme(new Theme());
public static Theme addTheme(@Nonnull Theme theme) {
THEMES.add(theme);
@ -39,7 +39,7 @@ public class Theme {
.filter(Objects::nonNull)
.findFirst()
.map(holder -> holder.lookupKey == null ? holder : resolve(holder.lookupKey))
.orElse(ColorHolder.missing);
.orElse(ColorHolder.MISSING);
}
@Nonnull public static Couple<Color> p(@Nonnull Key key) {return p(key.get());}
@ -144,40 +144,40 @@ public class Theme {
public static class Key {
public static Key BUTTON_IDLE = new Key();
public static Key BUTTON_HOVER = new Key();
public static Key BUTTON_CLICK = new Key();
public static Key BUTTON_DISABLE = new Key();
public static Key BUTTON_SUCCESS = new Key();
public static Key BUTTON_FAIL = new Key();
public static final Key BUTTON_IDLE = new Key();
public static final Key BUTTON_HOVER = new Key();
public static final Key BUTTON_CLICK = new Key();
public static final Key BUTTON_DISABLE = new Key();
public static final Key BUTTON_SUCCESS = new Key();
public static final Key BUTTON_FAIL = new Key();
public static Key TEXT = new Key();
public static Key TEXT_DARKER = new Key();
public static Key TEXT_ACCENT_STRONG = new Key();
public static Key TEXT_ACCENT_SLIGHT = new Key();
public static final Key TEXT = new Key();
public static final Key TEXT_DARKER = new Key();
public static final Key TEXT_ACCENT_STRONG = new Key();
public static final Key TEXT_ACCENT_SLIGHT = new Key();
public static Key STREAK = new Key();
public static Key VANILLA_TOOLTIP_BORDER = new Key();
public static Key VANILLA_TOOLTIP_BACKGROUND = new Key();
public static final Key STREAK = new Key();
public static final Key VANILLA_TOOLTIP_BORDER = new Key();
public static final Key VANILLA_TOOLTIP_BACKGROUND = new Key();
public static Key PONDER_BACKGROUND_TRANSPARENT = new Key();
public static Key PONDER_BACKGROUND_FLAT = new Key();
public static Key PONDER_IDLE = new Key();
public static Key PONDER_HOVER = new Key();
public static Key PONDER_HIGHLIGHT = new Key();
public static Key TEXT_WINDOW_BORDER = new Key();
public static Key PONDER_BACK_ARROW = new Key();
public static Key PONDER_PROGRESSBAR = new Key();
public static Key PONDER_MISSING_CREATE = new Key();
public static Key PONDER_MISSING_VANILLA = new Key();
public static final Key PONDER_BACKGROUND_TRANSPARENT = new Key();
public static final Key PONDER_BACKGROUND_FLAT = new Key();
public static final Key PONDER_IDLE = new Key();
public static final Key PONDER_HOVER = new Key();
public static final Key PONDER_HIGHLIGHT = new Key();
public static final Key TEXT_WINDOW_BORDER = new Key();
public static final Key PONDER_BACK_ARROW = new Key();
public static final Key PONDER_PROGRESSBAR = new Key();
public static final Key PONDER_MISSING_CREATE = new Key();
public static final Key PONDER_MISSING_VANILLA = new Key();
public static Key PONDER_BUTTON_IDLE = new Key();
public static Key PONDER_BUTTON_HOVER = new Key();
public static Key PONDER_BUTTON_CLICK = new Key();
public static Key PONDER_BUTTON_DISABLE = new Key();
public static final Key PONDER_BUTTON_IDLE = new Key();
public static final Key PONDER_BUTTON_HOVER = new Key();
public static final Key PONDER_BUTTON_CLICK = new Key();
public static final Key PONDER_BUTTON_DISABLE = new Key();
public static Key CONFIG_TITLE_A = new Key();
public static Key CONFIG_TITLE_B = new Key();
public static final Key CONFIG_TITLE_A = new Key();
public static final Key CONFIG_TITLE_B = new Key();
private static int index = 0;
@ -198,7 +198,7 @@ public class Theme {
private static class ColorHolder {
private static final ColorHolder missing = ColorHolder.single(Color.BLACK);
private static final ColorHolder MISSING = ColorHolder.single(Color.BLACK);
private Couple<Color> colors;
private String lookupKey;

View file

@ -30,7 +30,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
*/
public class DirectBeltInputBehaviour extends TileEntityBehaviour {
public static BehaviourType<DirectBeltInputBehaviour> TYPE = new BehaviourType<>();
public static final BehaviourType<DirectBeltInputBehaviour> TYPE = new BehaviourType<>();
private InsertionCallback tryInsert;
private AvailabilityPredicate canInsert;

View file

@ -1,22 +1,13 @@
package com.simibubi.create.foundation.utility.ghost;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import org.lwjgl.system.MemoryStack;
import com.jozufozu.flywheel.core.virtual.VirtualEmptyModelData;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3f;
import com.mojang.math.Vector4f;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
@ -31,28 +22,29 @@ import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.data.IModelData;
public abstract class GhostBlockRenderer {
private static final GhostBlockRenderer transparent = new TransparentGhostBlockRenderer();
public static GhostBlockRenderer transparent() {
return transparent;
}
private static final GhostBlockRenderer standard = new DefaultGhostBlockRenderer();
private static final GhostBlockRenderer STANDARD = new DefaultGhostBlockRenderer();
public static GhostBlockRenderer standard() {
return standard;
return STANDARD;
}
private static final GhostBlockRenderer TRANSPARENT = new TransparentGhostBlockRenderer();
public static GhostBlockRenderer transparent() {
return TRANSPARENT;
}
public abstract void render(PoseStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params);
private static class DefaultGhostBlockRenderer extends GhostBlockRenderer {
@Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params) {
ms.pushPose();
@ -78,19 +70,15 @@ public abstract class GhostBlockRenderer {
private static class TransparentGhostBlockRenderer extends GhostBlockRenderer {
@Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params) {
// prepare
ms.pushPose();
// RenderSystem.pushMatrix();
Minecraft mc = Minecraft.getInstance();
BlockRenderDispatcher dispatcher = mc.getBlockRenderer();
BakedModel model = dispatcher.getBlockModel(params.state);
// RenderType layer = RenderTypeLookup.getEntityBlockLayer(params.state);
RenderType layer = RenderType.translucent();
VertexConsumer vb = buffer.getEarlyBuffer(layer);
@ -101,104 +89,54 @@ public abstract class GhostBlockRenderer {
ms.scale(.85f, .85f, .85f);
ms.translate(-.5, -.5, -.5);
// dispatcher.getBlockModelRenderer().renderModel(ms.peek(), vb, params.state, model, 1f, 1f, 1f, LightTexture.FULL_BRIGHT, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE);
renderModel(params, ms.last(), vb, params.state, model, 1f, 1f, 1f,
float alpha = params.alphaSupplier.get() * .75f * PlacementHelpers.getCurrentAlpha();
renderModel(ms.last(), vb, params.state, model, 1f, 1f, 1f, alpha,
LevelRenderer.getLightColor(mc.level, pos), OverlayTexture.NO_OVERLAY,
VirtualEmptyModelData.INSTANCE);
// buffer.draw();
// clean
// RenderSystem.popMatrix();
ms.popPose();
}
// BlockModelRenderer
public void renderModel(GhostBlockParams params, PoseStack.Pose entry, VertexConsumer vb,
@Nullable BlockState state, BakedModel model, float p_228804_5_, float p_228804_6_, float p_228804_7_,
int p_228804_8_, int p_228804_9_, net.minecraftforge.client.model.data.IModelData modelData) {
// ModelBlockRenderer
public void renderModel(PoseStack.Pose pose, VertexConsumer consumer,
@Nullable BlockState state, BakedModel model, float red, float green, float blue,
float alpha, int packedLight, int packedOverlay, IModelData modelData) {
Random random = new Random();
for (Direction direction : Direction.values()) {
random.setSeed(42L);
renderQuad(params, entry, vb, p_228804_5_, p_228804_6_, p_228804_7_,
model.getQuads(state, direction, random, modelData), p_228804_8_, p_228804_9_);
renderQuadList(pose, consumer, red, green, blue, alpha,
model.getQuads(state, direction, random, modelData), packedLight, packedOverlay);
}
random.setSeed(42L);
renderQuad(params, entry, vb, p_228804_5_, p_228804_6_, p_228804_7_,
model.getQuads(state, (Direction) null, random, modelData), p_228804_8_, p_228804_9_);
renderQuadList(pose, consumer, red, green, blue, alpha,
model.getQuads(state, null, random, modelData), packedLight, packedOverlay);
}
// BlockModelRenderer
private static void renderQuad(GhostBlockParams params, PoseStack.Pose p_228803_0_,
VertexConsumer p_228803_1_, float p_228803_2_, float p_228803_3_, float p_228803_4_,
List<BakedQuad> p_228803_5_, int p_228803_6_, int p_228803_7_) {
Float alpha = params.alphaSupplier.get() * .75f * PlacementHelpers.getCurrentAlpha();
for (BakedQuad bakedquad : p_228803_5_) {
// ModelBlockRenderer
private static void renderQuadList(PoseStack.Pose pose, VertexConsumer consumer,
float red, float green, float blue, float alpha, List<BakedQuad> quads,
int packedLight, int packedOverlay) {
for (BakedQuad quad : quads) {
float f;
float f1;
float f2;
if (bakedquad.isTinted()) {
f = Mth.clamp(p_228803_2_, 0.0F, 1.0F);
f1 = Mth.clamp(p_228803_3_, 0.0F, 1.0F);
f2 = Mth.clamp(p_228803_4_, 0.0F, 1.0F);
if (quad.isTinted()) {
f = Mth.clamp(red, 0.0F, 1.0F);
f1 = Mth.clamp(green, 0.0F, 1.0F);
f2 = Mth.clamp(blue, 0.0F, 1.0F);
} else {
f = 1.0F;
f1 = 1.0F;
f2 = 1.0F;
}
quad(alpha, p_228803_1_, p_228803_0_, bakedquad, new float[] { 1f, 1f, 1f, 1f }, f, f1, f2,
new int[] { p_228803_6_, p_228803_6_, p_228803_6_, p_228803_6_ }, p_228803_7_);
consumer.putBulkData(pose, quad, f, f1, f2, alpha, packedLight, packedOverlay);
}
}
// IVertexBuilder
static void quad(float alpha, VertexConsumer vb, PoseStack.Pose p_227890_1_, BakedQuad p_227890_2_,
float[] p_227890_3_, float p_227890_4_, float p_227890_5_, float p_227890_6_, int[] p_227890_7_,
int p_227890_8_) {
int[] aint = p_227890_2_.getVertices();
Vec3i Vector3i = p_227890_2_.getDirection()
.getNormal();
Vector3f vector3f = new Vector3f((float) Vector3i.getX(), (float) Vector3i.getY(), (float) Vector3i.getZ());
Matrix4f matrix4f = p_227890_1_.pose();
vector3f.transform(p_227890_1_.normal());
int vertexSize = DefaultVertexFormat.BLOCK.getIntegerSize();
int j = aint.length / vertexSize;
try (MemoryStack memorystack = MemoryStack.stackPush()) {
ByteBuffer bytebuffer = memorystack.malloc(DefaultVertexFormat.BLOCK.getVertexSize());
IntBuffer intbuffer = bytebuffer.asIntBuffer();
for (int k = 0; k < j; ++k) {
((Buffer) intbuffer).clear();
intbuffer.put(aint, k * vertexSize, vertexSize);
float f = bytebuffer.getFloat(0);
float f1 = bytebuffer.getFloat(4);
float f2 = bytebuffer.getFloat(8);
float r;
float g;
float b;
r = p_227890_3_[k] * p_227890_4_;
g = p_227890_3_[k] * p_227890_5_;
b = p_227890_3_[k] * p_227890_6_;
int l = vb.applyBakedLighting(p_227890_7_[k], bytebuffer);
float f9 = bytebuffer.getFloat(16);
float f10 = bytebuffer.getFloat(20);
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
vector4f.transform(matrix4f);
vb.applyBakedNormals(vector3f, bytebuffer, p_227890_1_.normal());
vb.vertex(vector4f.x(), vector4f.y(), vector4f.z(), r, g, b, alpha, f9, f10, p_227890_8_,
l, vector3f.x(), vector3f.y(), vector3f.z());
}
}
}
}
}