Miscellaneous refactors

- Refactor custom rendered items; The renderer now creates the model
instead of the other way around
- Only tick wrench cog rotation and linked controller renderer if client
is not paused
- Move all model swapping code from CreateClient to ModelSwapper
- Register client resource reload listener before initial resource
reload
- Use TextureStitchEvent.Post event instead of resource reload listener
for filling sprites of SpriteShiftEntries
- Reuse Random instance in PartialItemModelRenderer
- Make all config fields final
- Merge package foundation.renderState into foundation.render
- Move BreakProgressHook from package foundation to foundation.block
- Rename ResourceReloadHandler to ClientResourceReloadListener
- Rename ProperDirectionalBlock to WrenchableDirectionalBlock
This commit is contained in:
PepperBell 2021-10-16 01:46:49 -07:00
parent 2bd10af1bc
commit 9870431db8
87 changed files with 498 additions and 485 deletions

View file

@ -11,7 +11,6 @@ import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.item.DyeColor;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
public class AllBlockPartials {
@ -145,14 +144,15 @@ public class AllBlockPartials {
}
private static PartialModel getEntity(String path) {
return new PartialModel(new ResourceLocation(Create.ID, "entity/" + path));
return new PartialModel(Create.asResource("entity/" + path));
}
private static PartialModel get(String path) {
return new PartialModel(new ResourceLocation(Create.ID, "block/" + path));
return new PartialModel(Create.asResource("block/" + path));
}
public static void clientInit() {
public static void init() {
// init static fields
}
}

View file

@ -21,7 +21,7 @@ import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlo
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem;
import com.simibubi.create.content.contraptions.relays.gearbox.VerticalGearboxItem;
import com.simibubi.create.content.contraptions.wrench.WrenchItem;
import com.simibubi.create.content.contraptions.wrench.WrenchModel;
import com.simibubi.create.content.contraptions.wrench.WrenchItemRenderer;
import com.simibubi.create.content.curiosities.BuildersTeaItem;
import com.simibubi.create.content.curiosities.ChromaticCompoundColor;
import com.simibubi.create.content.curiosities.ChromaticCompoundItem;
@ -34,18 +34,18 @@ import com.simibubi.create.content.curiosities.armor.CopperBacktankItem;
import com.simibubi.create.content.curiosities.armor.DivingBootsItem;
import com.simibubi.create.content.curiosities.armor.DivingHelmetItem;
import com.simibubi.create.content.curiosities.symmetry.SymmetryWandItem;
import com.simibubi.create.content.curiosities.symmetry.client.SymmetryWandModel;
import com.simibubi.create.content.curiosities.symmetry.client.SymmetryWandItemRenderer;
import com.simibubi.create.content.curiosities.tools.BlueprintItem;
import com.simibubi.create.content.curiosities.tools.ExtendoGripItem;
import com.simibubi.create.content.curiosities.tools.ExtendoGripModel;
import com.simibubi.create.content.curiosities.tools.ExtendoGripItemRenderer;
import com.simibubi.create.content.curiosities.tools.SandPaperItem;
import com.simibubi.create.content.curiosities.tools.SandPaperItemRenderer.SandPaperModel;
import com.simibubi.create.content.curiosities.tools.SandPaperItemRenderer;
import com.simibubi.create.content.curiosities.weapons.PotatoCannonItem;
import com.simibubi.create.content.curiosities.weapons.PotatoCannonModel;
import com.simibubi.create.content.curiosities.weapons.PotatoCannonItemRenderer;
import com.simibubi.create.content.curiosities.zapper.terrainzapper.WorldshaperItem;
import com.simibubi.create.content.curiosities.zapper.terrainzapper.WorldshaperModel;
import com.simibubi.create.content.curiosities.zapper.terrainzapper.WorldshaperItemRenderer;
import com.simibubi.create.content.logistics.item.LinkedControllerItem;
import com.simibubi.create.content.logistics.item.LinkedControllerModel;
import com.simibubi.create.content.logistics.item.LinkedControllerItemRenderer;
import com.simibubi.create.content.logistics.item.filter.FilterItem;
import com.simibubi.create.content.schematics.item.SchematicAndQuillItem;
import com.simibubi.create.content.schematics.item.SchematicItem;
@ -227,19 +227,19 @@ public class AllItems {
.register();
public static final ItemEntry<SandPaperItem> SAND_PAPER = REGISTRATE.item("sand_paper", SandPaperItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> SandPaperModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> SandPaperItemRenderer::new))
.tag(AllTags.AllItemTags.SANDPAPER.tag)
.register();
public static final ItemEntry<SandPaperItem> RED_SAND_PAPER = REGISTRATE.item("red_sand_paper", SandPaperItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> SandPaperModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> SandPaperItemRenderer::new))
.tag(AllTags.AllItemTags.SANDPAPER.tag)
.onRegister(s -> TooltipHelper.referTo(s, SAND_PAPER))
.register();
public static final ItemEntry<WrenchItem> WRENCH = REGISTRATE.item("wrench", WrenchItem::new)
.properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> WrenchModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> WrenchItemRenderer::new))
.model(AssetLookup.itemModelWithPartials())
.register();
@ -264,32 +264,32 @@ public class AllItems {
public static final ItemEntry<LinkedControllerItem> LINKED_CONTROLLER =
REGISTRATE.item("linked_controller", LinkedControllerItem::new)
.properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> LinkedControllerModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> LinkedControllerItemRenderer::new))
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<PotatoCannonItem> POTATO_CANNON =
REGISTRATE.item("potato_cannon", PotatoCannonItem::new)
.properties(p -> p.stacksTo(1))
.transform(CreateRegistrate.customRenderedItem(() -> PotatoCannonModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> PotatoCannonItemRenderer::new))
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<ExtendoGripItem> EXTENDO_GRIP = REGISTRATE.item("extendo_grip", ExtendoGripItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> ExtendoGripModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> ExtendoGripItemRenderer::new))
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<SymmetryWandItem> WAND_OF_SYMMETRY =
REGISTRATE.item("wand_of_symmetry", SymmetryWandItem::new)
.transform(CreateRegistrate.customRenderedItem(() -> SymmetryWandModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> SymmetryWandItemRenderer::new))
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<WorldshaperItem> WORLDSHAPER =
REGISTRATE.item("handheld_worldshaper", WorldshaperItem::new)
.properties(p -> p.rarity(Rarity.EPIC))
.transform(CreateRegistrate.customRenderedItem(() -> WorldshaperModel::new))
.transform(CreateRegistrate.customRenderedItem(() -> WorldshaperItemRenderer::new))
.lang("Creative Worldshaper")
.model(AssetLookup.itemModelWithPartials())
.register();

View file

@ -80,6 +80,12 @@ public class Create {
private static final NonNullLazyValue<CreateRegistrate> REGISTRATE = CreateRegistrate.lazy(ID);
public Create() {
onCtor();
}
public static void onCtor() {
ModLoadingContext modLoadingContext = ModLoadingContext.get();
AllSoundEvents.prepare();
AllBlocks.register();
AllItems.register();
@ -92,7 +98,7 @@ public class Create {
AllMovementBehaviours.register();
AllWorldFeatures.register();
AllEnchantments.register();
AllConfigs.register(ModLoadingContext.get());
AllConfigs.register(modLoadingContext);
BlockSpoutingBehaviour.register();
ForgeMod.enableMilkFluid();
@ -109,12 +115,13 @@ public class Create {
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
modEventBus.addListener(AllConfigs::onLoad);
modEventBus.addListener(AllConfigs::onReload);
modEventBus.addListener(EventPriority.LOWEST, this::gatherData);
modEventBus.addListener(EventPriority.LOWEST, Create::gatherData);
forgeEventBus.addListener(EventPriority.HIGH, Create::onBiomeLoad);
forgeEventBus.register(CHUNK_UTIL);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
() -> () -> CreateClient.addClientListeners(forgeEventBus, modEventBus));
() -> () -> CreateClient.onCtorClient(modEventBus, forgeEventBus));
}
public static void init(final FMLCommonSetupEvent event) {
@ -132,7 +139,7 @@ public class Create {
});
}
public void gatherData(GatherDataEvent event) {
public static void gatherData(GatherDataEvent event) {
DataGenerator gen = event.getGenerator();
gen.addProvider(new AllAdvancements(gen));
gen.addProvider(new LangMerger(gen));

View file

@ -1,10 +1,5 @@
package com.simibubi.create;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
import com.simibubi.create.content.contraptions.components.structureMovement.render.SBBContraptionManager;
@ -17,34 +12,25 @@ import com.simibubi.create.content.schematics.ClientSchematicLoader;
import com.simibubi.create.content.schematics.client.SchematicAndQuillHandler;
import com.simibubi.create.content.schematics.client.SchematicHandler;
import com.simibubi.create.events.ClientEvents;
import com.simibubi.create.foundation.ResourceReloadHandler;
import com.simibubi.create.foundation.block.render.CustomBlockModels;
import com.simibubi.create.foundation.ClientResourceReloadListener;
import com.simibubi.create.foundation.block.render.SpriteShifter;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.item.render.CustomItemModels;
import com.simibubi.create.foundation.item.render.CustomRenderedItems;
import com.simibubi.create.foundation.ponder.content.PonderIndex;
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.render.AllMaterialSpecs;
import com.simibubi.create.foundation.render.CreateContexts;
import com.simibubi.create.foundation.render.SuperByteBufferCache;
import com.simibubi.create.foundation.utility.ModelSwapper;
import com.simibubi.create.foundation.utility.ghost.GhostBlocks;
import com.simibubi.create.foundation.utility.outliner.Outliner;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.client.settings.GraphicsFanciness;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.item.Item;
import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ChatType;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.StringTextComponent;
@ -52,55 +38,57 @@ import net.minecraft.util.text.TextComponentUtils;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent;
import net.minecraft.util.text.event.HoverEvent;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
public class CreateClient {
public static final ClientSchematicLoader SCHEMATIC_SENDER = new ClientSchematicLoader();
public static final SchematicHandler SCHEMATIC_HANDLER = new SchematicHandler();
public static final SchematicAndQuillHandler SCHEMATIC_AND_QUILL_HANDLER = new SchematicAndQuillHandler();
public static final SuperByteBufferCache BUFFER_CACHE = new SuperByteBufferCache();
public static final Outliner OUTLINER = new Outliner();
public static final GhostBlocks GHOST_BLOCKS = new GhostBlocks();
public static final Screen EMPTY_SCREEN = new Screen(new StringTextComponent("")) {};
public static final ModelSwapper MODEL_SWAPPER = new ModelSwapper();
public static final CasingConnectivity CASING_CONNECTIVITY = new CasingConnectivity();
public static final ClientSchematicLoader SCHEMATIC_SENDER = new ClientSchematicLoader();
public static final SchematicHandler SCHEMATIC_HANDLER = new SchematicHandler();
public static final SchematicAndQuillHandler SCHEMATIC_AND_QUILL_HANDLER = new SchematicAndQuillHandler();
public static final ZapperRenderHandler ZAPPER_RENDER_HANDLER = new ZapperRenderHandler();
public static final PotatoCannonRenderHandler POTATO_CANNON_RENDER_HANDLER = new PotatoCannonRenderHandler();
public static final SoulPulseEffectHandler SOUL_PULSE_EFFECT_HANDLER = new SoulPulseEffectHandler();
private static CustomBlockModels customBlockModels;
private static CustomItemModels customItemModels;
private static CustomRenderedItems customRenderedItems;
private static CasingConnectivity casingConnectivity;
public static final ClientResourceReloadListener RESOURCE_RELOAD_LISTENER = new ClientResourceReloadListener();
public static void addClientListeners(IEventBus forgeEventBus, IEventBus modEventBus) {
public static void onCtorClient(IEventBus modEventBus, IEventBus forgeEventBus) {
modEventBus.addListener(CreateClient::clientInit);
modEventBus.addListener(CreateClient::onTextureStitch);
modEventBus.addListener(CreateClient::onModelRegistry);
modEventBus.addListener(CreateClient::onModelBake);
modEventBus.addListener(AllParticleTypes::registerFactories);
modEventBus.addListener(ClientEvents::loadCompleted);
modEventBus.addListener(SpriteShifter::onTextureStitchPre);
modEventBus.addListener(SpriteShifter::onTextureStitchPost);
modEventBus.addListener(AllParticleTypes::registerFactories);
modEventBus.addListener(CreateContexts::flwInit);
modEventBus.addListener(AllMaterialSpecs::flwInit);
modEventBus.addListener(ContraptionRenderDispatcher::gatherContext);
ZAPPER_RENDER_HANDLER.register(forgeEventBus);
POTATO_CANNON_RENDER_HANDLER.register(forgeEventBus);
MODEL_SWAPPER.registerListeners(modEventBus);
ZAPPER_RENDER_HANDLER.registerListeners(forgeEventBus);
POTATO_CANNON_RENDER_HANDLER.registerListeners(forgeEventBus);
IResourceManager resourceManager = Minecraft.getInstance()
.getResourceManager();
if (resourceManager instanceof IReloadableResourceManager)
((IReloadableResourceManager) resourceManager).registerReloadListener(RESOURCE_RELOAD_LISTENER);
}
public static void clientInit(FMLClientSetupEvent event) {
public static void clientInit(final FMLClientSetupEvent event) {
BUFFER_CACHE.registerCompartment(KineticTileEntityRenderer.KINETIC_TILE);
BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20);
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
AllKeys.register();
// AllFluids.assignRenderLayers();
AllBlockPartials.clientInit();
AllBlockPartials.init();
AllStitchedTextures.init();
PonderIndex.register();
@ -109,102 +97,15 @@ public class CreateClient {
UIRenderHelper.init();
event.enqueueWork(() -> {
IResourceManager resourceManager = Minecraft.getInstance()
.getResourceManager();
if (resourceManager instanceof IReloadableResourceManager)
((IReloadableResourceManager) resourceManager).registerReloadListener(new ResourceReloadHandler());
registerLayerRenderers(Minecraft.getInstance()
.getEntityRenderDispatcher());
});
}
public static void onTextureStitch(TextureStitchEvent.Pre event) {
if (!event.getMap()
.location()
.equals(PlayerContainer.BLOCK_ATLAS))
return;
SpriteShifter.getAllTargetSprites()
.forEach(event::addSprite);
}
public static void onModelRegistry(ModelRegistryEvent event) {
getCustomRenderedItems().foreach((item, modelFunc) -> modelFunc.apply(null)
.getModelLocations()
.forEach(ModelLoader::addSpecialModel));
}
public static void onModelBake(ModelBakeEvent event) {
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
getCustomBlockModels()
.foreach((block, modelFunc) -> swapModels(modelRegistry, getAllBlockStateModelLocations(block), modelFunc));
getCustomItemModels()
.foreach((item, modelFunc) -> swapModels(modelRegistry, getItemModelLocation(item), modelFunc));
getCustomRenderedItems().foreach((item, modelFunc) -> {
swapModels(modelRegistry, getItemModelLocation(item), m -> modelFunc.apply(m)
.loadPartials(event));
});
}
protected static ModelResourceLocation getItemModelLocation(Item item) {
return new ModelResourceLocation(item.getRegistryName(), "inventory");
}
protected static List<ModelResourceLocation> getAllBlockStateModelLocations(Block block) {
List<ModelResourceLocation> models = new ArrayList<>();
block.getStateDefinition()
.getPossibleStates()
.forEach(state -> {
models.add(getBlockModelLocation(block, BlockModelShapes.statePropertiesToString(state.getValues())));
});
return models;
}
protected static ModelResourceLocation getBlockModelLocation(Block block, String suffix) {
return new ModelResourceLocation(block.getRegistryName(), suffix);
}
protected static <T extends IBakedModel> void swapModels(Map<ResourceLocation, IBakedModel> modelRegistry,
List<ModelResourceLocation> locations, Function<IBakedModel, T> factory) {
locations.forEach(location -> {
swapModels(modelRegistry, location, factory);
});
}
protected static <T extends IBakedModel> void swapModels(Map<ResourceLocation, IBakedModel> modelRegistry,
ModelResourceLocation location, Function<IBakedModel, T> factory) {
modelRegistry.put(location, factory.apply(modelRegistry.get(location)));
}
protected static void registerLayerRenderers(EntityRendererManager renderManager) {
CopperBacktankArmorLayer.registerOnAll(renderManager);
}
public static CustomItemModels getCustomItemModels() {
if (customItemModels == null)
customItemModels = new CustomItemModels();
return customItemModels;
}
public static CustomRenderedItems getCustomRenderedItems() {
if (customRenderedItems == null)
customRenderedItems = new CustomRenderedItems();
return customRenderedItems;
}
public static CustomBlockModels getCustomBlockModels() {
if (customBlockModels == null)
customBlockModels = new CustomBlockModels();
return customBlockModels;
}
public static CasingConnectivity getCasingConnectivity() {
if (casingConnectivity == null)
casingConnectivity = new CasingConnectivity();
return casingConnectivity;
}
public static void invalidateRenderers() {
BUFFER_CACHE.invalidate();
@ -233,4 +134,5 @@ public class CreateClient {
mc.gui.handleChat(ChatType.CHAT, text, mc.player.getUUID());
}
}

View file

@ -5,7 +5,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block;
@ -20,7 +20,7 @@ import net.minecraft.world.World;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class PortableStorageInterfaceBlock extends ProperDirectionalBlock
public class PortableStorageInterfaceBlock extends WrenchableDirectionalBlock
implements ITE<PortableStorageInterfaceTileEntity> {
boolean fluids;

View file

@ -4,7 +4,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block;
@ -24,7 +24,7 @@ import net.minecraft.world.World;
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public class NozzleBlock extends ProperDirectionalBlock {
public class NozzleBlock extends WrenchableDirectionalBlock {
public NozzleBlock(Properties p_i48415_1_) {
super(p_i48415_1_);

View file

@ -10,7 +10,7 @@ import javax.annotation.Nullable;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.utility.DyeHelper;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
@ -41,7 +41,7 @@ import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
public class SailBlock extends ProperDirectionalBlock {
public class SailBlock extends WrenchableDirectionalBlock {
public static SailBlock frame(Properties properties) {
return new SailBlock(properties, true);

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ch
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -25,7 +25,7 @@ import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
public class StickerBlock extends ProperDirectionalBlock implements ITE<StickerTileEntity> {
public class StickerBlock extends WrenchableDirectionalBlock implements ITE<StickerTileEntity> {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public static final BooleanProperty EXTENDED = BlockStateProperties.EXTENDED;

View file

@ -5,7 +5,7 @@ import static com.simibubi.create.content.contraptions.components.structureMovem
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -30,7 +30,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public class MechanicalPistonHeadBlock extends ProperDirectionalBlock implements IWaterLoggable {
public class MechanicalPistonHeadBlock extends WrenchableDirectionalBlock implements IWaterLoggable {
public static final EnumProperty<PistonType> TYPE = BlockStateProperties.PISTON_TYPE;

View file

@ -10,7 +10,7 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
import com.simibubi.create.foundation.utility.placement.util.PoleHelper;
@ -44,7 +44,7 @@ import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements IWrenchable, IWaterLoggable {
public class PistonExtensionPoleBlock extends WrenchableDirectionalBlock implements IWrenchable, IWaterLoggable {
private static final int placementHelperId = PlacementHelpers.register(PlacementHelper.get());

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.components.structureMovement.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
public class LightVolumeDebugger {
public static void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {

View file

@ -7,7 +7,7 @@ import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock;
import com.simibubi.create.content.contraptions.fluids.FluidPropagator;
import com.simibubi.create.content.contraptions.relays.elementary.AbstractShaftBlock;
import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block;
@ -19,7 +19,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.IStringSerializable;
public class BracketBlock extends ProperDirectionalBlock {
public class BracketBlock extends WrenchableDirectionalBlock {
public static final BooleanProperty AXIS_ALONG_FIRST_COORDINATE =
DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;

View file

@ -95,7 +95,7 @@ public interface IHaveGoggleInformation {
class Format {
private NumberFormat format = NumberFormat.getNumberInstance(Locale.ROOT);;
private NumberFormat format = NumberFormat.getNumberInstance(Locale.ROOT);
private Format() {}

View file

@ -145,9 +145,9 @@ public class BasinRecipe extends ProcessingRecipe<SmartInventory> {
if (fluidsAffected) {
basin.getBehaviour(SmartFluidTankBehaviour.INPUT)
.foreach(TankSegment::onFluidStackChanged);
.forEach(TankSegment::onFluidStackChanged);
basin.getBehaviour(SmartFluidTankBehaviour.OUTPUT)
.foreach(TankSegment::onFluidStackChanged);
.forEach(TankSegment::onFluidStackChanged);
}
if (simulate) {

View file

@ -22,7 +22,7 @@ public class EncasedCTBehaviour extends ConnectedTextureBehaviour {
Direction face) {
if (isBeingBlocked(state, reader, pos, otherPos, face))
return false;
CasingConnectivity cc = CreateClient.getCasingConnectivity();
CasingConnectivity cc = CreateClient.CASING_CONNECTIVITY;
CasingConnectivity.Entry entry = cc.get(state);
CasingConnectivity.Entry otherEntry = cc.get(other);
if (entry == null || otherEntry == null)

View file

@ -7,6 +7,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollVal
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.vector.Vector3f;
@ -26,4 +27,9 @@ public class WrenchItemRenderer extends CustomRenderedItemModelRenderer<WrenchMo
renderer.render(model.getPartial("gear"), light);
}
@Override
public WrenchModel createModel(IBakedModel originalModel) {
return new WrenchModel(originalModel);
}
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.wrench;
import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
public class WrenchModel extends CreateCustomRenderedItemModel {
@ -12,9 +11,4 @@ public class WrenchModel extends CreateCustomRenderedItemModel {
addPartials("gear");
}
@Override
public ItemStackTileEntityRenderer createRenderer() {
return new WrenchItemRenderer();
}
}

View file

@ -6,6 +6,7 @@ import com.simibubi.create.foundation.item.render.PartialItemModelRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
@ -32,4 +33,9 @@ public class SymmetryWandItemRenderer extends CustomRenderedItemModelRenderer<Sy
renderer.renderGlowing(model.getPartial("bits"), maxLight);
}
@Override
public SymmetryWandModel createModel(IBakedModel originalModel) {
return new SymmetryWandModel(originalModel);
}
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.curiosities.symmetry.client;
import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
public class SymmetryWandModel extends CreateCustomRenderedItemModel {
@ -12,9 +11,4 @@ public class SymmetryWandModel extends CreateCustomRenderedItemModel {
addPartials("bits", "core", "core_glow");
}
@Override
public ItemStackTileEntityRenderer createRenderer() {
return new SymmetryWandItemRenderer();
}
}

View file

@ -8,6 +8,7 @@ import com.simibubi.create.foundation.item.render.PartialItemModelRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
@ -107,4 +108,9 @@ public class ExtendoGripItemRenderer extends CustomRenderedItemModelRenderer<Ext
ms.popPose();
}
@Override
public ExtendoGripModel createModel(IBakedModel originalModel) {
return new ExtendoGripModel(originalModel);
}
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.curiosities.tools;
import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
public class ExtendoGripModel extends CreateCustomRenderedItemModel {
@ -12,9 +11,4 @@ public class ExtendoGripModel extends CreateCustomRenderedItemModel {
addPartials("cog", "thin_short", "wide_short", "thin_long", "wide_long");
}
@Override
public ItemStackTileEntityRenderer createRenderer() {
return new ExtendoGripItemRenderer();
}
}

View file

@ -2,6 +2,8 @@ package com.simibubi.create.content.curiosities.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel;
import com.simibubi.create.foundation.item.render.CustomRenderedItemModelRenderer;
import com.simibubi.create.foundation.item.render.PartialItemModelRenderer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.Minecraft;
@ -10,30 +12,28 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3f;
public class SandPaperItemRenderer extends ItemStackTileEntityRenderer {
public class SandPaperItemRenderer extends CustomRenderedItemModelRenderer<SandPaperItemRenderer.SandPaperModel> {
@Override
public void renderByItem(ItemStack stack, TransformType transformType, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
protected void render(ItemStack stack, SandPaperModel model, PartialItemModelRenderer renderer,
TransformType transformType, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
ClientPlayerEntity player = Minecraft.getInstance().player;
SandPaperModel mainModel = (SandPaperModel) itemRenderer.getModel(stack, Minecraft.getInstance().level, null);
float partialTicks = AnimationTickHolder.getPartialTicks();
boolean leftHand = transformType == TransformType.FIRST_PERSON_LEFT_HAND;
boolean firstPerson = leftHand || transformType == TransformType.FIRST_PERSON_RIGHT_HAND;
ms.pushPose();
ms.translate(.5f, .5f, .5f);
CompoundNBT tag = stack.getOrCreateTag();
boolean jeiMode = tag.contains("JEI");
ms.pushPose();
if (tag.contains("Polishing")) {
ms.pushPose();
@ -74,22 +74,22 @@ public class SandPaperItemRenderer extends ItemStackTileEntityRenderer {
}
}
itemRenderer.render(stack, TransformType.NONE, false, ms, buffer, light, overlay, mainModel.getOriginalModel());
itemRenderer.render(stack, TransformType.NONE, false, ms, buffer, light, overlay, model.getOriginalModel());
ms.popPose();
}
@Override
public SandPaperModel createModel(IBakedModel originalModel) {
return new SandPaperModel(originalModel);
}
public static class SandPaperModel extends CreateCustomRenderedItemModel {
public SandPaperModel(IBakedModel template) {
super(template, "");
}
@Override
public ItemStackTileEntityRenderer createRenderer() {
return new SandPaperItemRenderer();
}
}
}

View file

@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.item.ItemStack;
@ -62,4 +63,9 @@ public class PotatoCannonItemRenderer extends CustomRenderedItemModelRenderer<Po
}
@Override
public PotatoCannonModel createModel(IBakedModel originalModel) {
return new PotatoCannonModel(originalModel);
}
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.curiosities.weapons;
import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
public class PotatoCannonModel extends CreateCustomRenderedItemModel {
@ -12,9 +11,4 @@ public class PotatoCannonModel extends CreateCustomRenderedItemModel {
addPartials("cog");
}
@Override
public ItemStackTileEntityRenderer createRenderer() {
return new PotatoCannonItemRenderer();
}
}

View file

@ -65,7 +65,7 @@ public abstract class ShootableGadgetRenderHandler {
protected abstract void transformHand(MatrixStack ms, float flip, float equipProgress, float recoil, float pt);
public void register(IEventBus bus) {
public void registerListeners(IEventBus bus) {
bus.addListener(this::onRenderPlayerHand);
}

View file

@ -88,8 +88,8 @@ public class WorldshaperItem extends ZapperItem {
CompoundNBT nbt = stack.getOrCreateTag();
NBTHelper.writeEnum(nbt, "Brush", brush);
nbt.put("BrushParams", NBTUtil.writeBlockPos(new BlockPos(brushParamX, brushParamY, brushParamZ)));
nbt.putString("Tool", tool.name());
nbt.putString("Placement", placement.name());
NBTHelper.writeEnum(nbt, "Tool", tool);
NBTHelper.writeEnum(nbt, "Placement", placement);
}
}

View file

@ -12,6 +12,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.item.ItemStack;
import net.minecraft.util.HandSide;
@ -59,4 +60,9 @@ public class WorldshaperItemRenderer extends ZapperItemRenderer<WorldshaperModel
renderer.render(model.getPartial("accelerator"), light);
}
@Override
public WorldshaperModel createModel(IBakedModel originalModel) {
return new WorldshaperModel(originalModel);
}
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.curiosities.zapper.terrainzapper;
import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
public class WorldshaperModel extends CreateCustomRenderedItemModel {
@ -12,9 +11,4 @@ public class WorldshaperModel extends CreateCustomRenderedItemModel {
addPartials("core", "core_glow", "accelerator");
}
@Override
public ItemStackTileEntityRenderer createRenderer() {
return new WorldshaperItemRenderer();
}
}

View file

@ -2,7 +2,7 @@ package com.simibubi.create.content.logistics.block.inventories;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block;
@ -19,7 +19,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
public class CrateBlock extends ProperDirectionalBlock implements IWrenchable {
public class CrateBlock extends WrenchableDirectionalBlock implements IWrenchable {
public static final BooleanProperty DOUBLE = BooleanProperty.create("double");

View file

@ -6,7 +6,7 @@ import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.Block;
@ -24,7 +24,7 @@ import net.minecraft.world.server.ServerWorld;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class RedstoneContactBlock extends ProperDirectionalBlock {
public class RedstoneContactBlock extends WrenchableDirectionalBlock {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;

View file

@ -5,7 +5,7 @@ import java.util.Random;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.block.Block;
@ -30,7 +30,7 @@ import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE<RedstoneLinkTileEntity> {
public class RedstoneLinkBlock extends WrenchableDirectionalBlock implements ITE<RedstoneLinkTileEntity> {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public static final BooleanProperty RECEIVER = BooleanProperty.create("receiver");

View file

@ -36,6 +36,10 @@ public class LinkedControllerItemRenderer extends CustomRenderedItemModelRendere
}
static void tick() {
if (Minecraft.getInstance()
.isPaused())
return;
boolean active = LinkedControllerClientHandler.MODE != Mode.IDLE;
equipProgress.chase(active ? 1 : 0, .2f, Chaser.EXP);
equipProgress.tickChaser();
@ -164,6 +168,11 @@ public class LinkedControllerItemRenderer extends CustomRenderedItemModelRendere
ms.popPose();
}
@Override
public LinkedControllerModel createModel(IBakedModel originalModel) {
return new LinkedControllerModel(originalModel);
}
protected enum RenderType {
NORMAL, LECTERN;
}

View file

@ -3,7 +3,6 @@ package com.simibubi.create.content.logistics.item;
import com.simibubi.create.foundation.item.render.CreateCustomRenderedItemModel;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
public class LinkedControllerModel extends CreateCustomRenderedItemModel {
@ -12,9 +11,4 @@ public class LinkedControllerModel extends CreateCustomRenderedItemModel {
addPartials("powered", "button");
}
@Override
public ItemStackTileEntityRenderer createRenderer() {
return new LinkedControllerItemRenderer();
}
}

View file

@ -16,7 +16,7 @@ import com.simibubi.create.content.schematics.packet.SchematicPlacePacket;
import com.simibubi.create.content.schematics.packet.SchematicSyncPacket;
import com.simibubi.create.foundation.gui.ToolSelectionScreen;
import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.outliner.AABBOutline;

View file

@ -13,8 +13,8 @@ import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.schematics.SchematicWorld;
import com.simibubi.create.foundation.render.SuperByteBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.TileEntityRenderHelper;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;

View file

@ -4,7 +4,7 @@ import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllKeys;
import com.simibubi.create.content.schematics.client.SchematicTransformation;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.outliner.AABBOutline;

View file

@ -2,7 +2,7 @@ package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.outliner.AABBOutline;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.client.renderer.IRenderTypeBuffer;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.client.renderer.IRenderTypeBuffer;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.outliner.LineOutline;

View file

@ -9,7 +9,7 @@ import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.CreateClient;
import com.simibubi.create.content.schematics.client.SchematicHandler;
import com.simibubi.create.content.schematics.client.SchematicTransformation;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.RaycastHelper;
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;

View file

@ -22,7 +22,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.tra
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
import com.simibubi.create.content.contraptions.components.turntable.TurntableHandler;
import com.simibubi.create.content.contraptions.goggles.GoggleOverlayRenderer;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.contraptions.itemAssembly.SequencedAssemblyRecipe;
import com.simibubi.create.content.contraptions.relays.belt.BeltSlicer;
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorHandler;
@ -43,7 +42,7 @@ import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.networking.LeftClickPacket;
import com.simibubi.create.foundation.ponder.PonderTooltipHandler;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.sound.SoundScapes;
import com.simibubi.create.foundation.tileEntity.behaviour.edgeInteraction.EdgeInteractionRenderer;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringRenderer;
@ -98,10 +97,10 @@ public class ClientEvents {
@SubscribeEvent
public static void onTick(ClientTickEvent event) {
World world = Minecraft.getInstance().level;
if (!isGameActive())
return;
World world = Minecraft.getInstance().level;
if (event.phase == Phase.START) {
LinkedControllerClientHandler.tick();
AirCurrent.tickClientPlayerSounds();
@ -161,13 +160,6 @@ public class ClientEvents {
CreateClient.invalidateRenderers();
AnimationTickHolder.reset();
}
/*
* i was getting nullPointers when trying to call this during client setup,
* so i assume minecraft's language manager isn't yet fully loaded at that time.
* not sure where else to call this tho :S
*/
IHaveGoggleInformation.numberFormat.update();
}
@SubscribeEvent

View file

@ -2,21 +2,19 @@ package com.simibubi.create.foundation;
import com.simibubi.create.CreateClient;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.block.render.SpriteShifter;
import com.simibubi.create.foundation.sound.SoundScapes;
import com.simibubi.create.foundation.utility.ISimpleReloadListener;
import net.minecraft.profiler.IProfiler;
import net.minecraft.resources.IResourceManager;
public class ResourceReloadHandler implements ISimpleReloadListener {
public class ClientResourceReloadListener implements ISimpleReloadListener {
@Override
public void onReload(IResourceManager resourceManagerIn, IProfiler profilerIn) {
SpriteShifter.reloadUVs();
public void onReload(IResourceManager resourceManager, IProfiler profiler) {
CreateClient.invalidateRenderers();
IHaveGoggleInformation.numberFormat.update();
SoundScapes.invalidateAll();
IHaveGoggleInformation.numberFormat.update();
}
}

View file

@ -1,4 +1,4 @@
package com.simibubi.create.foundation;
package com.simibubi.create.foundation.block;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;

View file

@ -12,9 +12,9 @@ import net.minecraft.util.Direction;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
public class ProperDirectionalBlock extends DirectionalBlock implements IWrenchable {
public class WrenchableDirectionalBlock extends DirectionalBlock implements IWrenchable {
public ProperDirectionalBlock(Properties p_i48415_1_) {
public WrenchableDirectionalBlock(Properties p_i48415_1_) {
super(p_i48415_1_);
}

View file

@ -29,7 +29,7 @@ public class CustomBlockModels {
registered.add(Pair.of(entry, behaviour));
}
public void foreach(NonNullBiConsumer<Block, NonNullFunction<IBakedModel, ? extends IBakedModel>> consumer) {
public void forEach(NonNullBiConsumer<Block, NonNullFunction<IBakedModel, ? extends IBakedModel>> consumer) {
loadEntriesIfMissing();
customModels.forEach(consumer);
}

View file

@ -1,10 +1,7 @@
package com.simibubi.create.foundation.block.render;
import java.util.function.Function;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.util.ResourceLocation;
public class SpriteShiftEntry {
@ -18,26 +15,24 @@ public class SpriteShiftEntry {
this.targetTextureLocation = targetTextureLocation;
}
protected void loadTextures() {
Function<ResourceLocation, TextureAtlasSprite> textureMap = Minecraft.getInstance()
.getTextureAtlas(PlayerContainer.BLOCK_ATLAS);
original = textureMap.apply(originalTextureLocation);
target = textureMap.apply(targetTextureLocation);
public ResourceLocation getOriginalResourceLocation() {
return originalTextureLocation;
}
public ResourceLocation getTargetResourceLocation() {
return targetTextureLocation;
}
public TextureAtlasSprite getOriginal() {
return original;
}
public TextureAtlasSprite getTarget() {
if (target == null)
loadTextures();
return target;
}
public TextureAtlasSprite getOriginal() {
if (original == null)
loadTextures();
return original;
protected void loadTextures(AtlasTexture atlas) {
original = atlas.getSprite(originalTextureLocation);
target = atlas.getSprite(targetTextureLocation);
}
}

View file

@ -7,7 +7,10 @@ import java.util.stream.Collectors;
import com.simibubi.create.Create;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.TextureStitchEvent;
public class SpriteShifter {
@ -28,12 +31,30 @@ public class SpriteShifter {
return get(Create.asResource(originalLocation), Create.asResource(targetLocation));
}
public static void reloadUVs() {
ENTRY_CACHE.values().forEach(SpriteShiftEntry::loadTextures);
}
public static List<ResourceLocation> getAllTargetSprites() {
return ENTRY_CACHE.values().stream().map(SpriteShiftEntry::getTargetResourceLocation).collect(Collectors.toList());
}
public static void onTextureStitchPre(TextureStitchEvent.Pre event) {
if (!event.getMap()
.location()
.equals(PlayerContainer.BLOCK_ATLAS))
return;
getAllTargetSprites()
.forEach(event::addSprite);
}
public static void onTextureStitchPost(TextureStitchEvent.Post event) {
if (!event.getMap()
.location()
.equals(PlayerContainer.BLOCK_ATLAS))
return;
AtlasTexture atlas = event.getMap();
for (SpriteShiftEntry entry : ENTRY_CACHE.values()) {
entry.loadTextures(atlas);
}
}
}

View file

@ -12,16 +12,19 @@ import com.simibubi.create.foundation.block.BlockStressValues;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.config.ModConfig.Type;
public class AllConfigs {
static Map<ConfigBase, ModConfig.Type> configs = new HashMap<>();
private static final Map<ModConfig.Type, ConfigBase> CONFIGS = new HashMap<>();
public static CClient CLIENT;
public static CCommon COMMON;
public static CServer SERVER;
public static ConfigBase byType(ModConfig.Type type) {
return CONFIGS.get(type);
}
private static <T extends ConfigBase> T register(Supplier<T> factory, ModConfig.Type side) {
Pair<T, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(builder -> {
T config = factory.get();
@ -31,7 +34,7 @@ public class AllConfigs {
T config = specPair.getLeft();
config.specification = specPair.getRight();
configs.put(config, side);
CONFIGS.put(side, config);
return config;
}
@ -40,25 +43,24 @@ public class AllConfigs {
COMMON = register(CCommon::new, ModConfig.Type.COMMON);
SERVER = register(CServer::new, ModConfig.Type.SERVER);
for (Entry<ConfigBase, Type> pair : configs.entrySet())
context.registerConfig(pair.getValue(), pair.getKey().specification);
for (Entry<ModConfig.Type, ConfigBase> pair : CONFIGS.entrySet())
context.registerConfig(pair.getKey(), pair.getValue().specification);
BlockStressValues.registerProvider(context.getActiveNamespace(), SERVER.kinetics.stressValues);
}
public static void onLoad(ModConfig.Loading event) {
for (Entry<ConfigBase, Type> pair : configs.entrySet())
if (pair.getKey().specification == event.getConfig()
for (ConfigBase config : CONFIGS.values())
if (config.specification == event.getConfig()
.getSpec())
pair.getKey()
.onLoad();
config.onLoad();
}
public static void onReload(ModConfig.Reloading event) {
for (Entry<ConfigBase, Type> pair : configs.entrySet())
if (pair.getKey().specification == event.getConfig()
for (ConfigBase config : CONFIGS.values())
if (config.specification == event.getConfig()
.getSpec())
pair.getKey()
.onReload();
config.onReload();
}
}

View file

@ -4,73 +4,73 @@ import com.simibubi.create.foundation.config.ui.ConfigAnnotations;
public class CClient extends ConfigBase {
public ConfigGroup client = group(0, "client",
public final ConfigGroup client = group(0, "client",
Comments.client);
//no group
public ConfigBool tooltips = b(true, "enableTooltips",
public final ConfigBool tooltips = b(true, "enableTooltips",
Comments.tooltips);
public ConfigBool enableOverstressedTooltip = b(true, "enableOverstressedTooltip",
public final ConfigBool enableOverstressedTooltip = b(true, "enableOverstressedTooltip",
Comments.enableOverstressedTooltip);
public ConfigBool explainRenderErrors = b(false, "explainRenderErrors",
public final ConfigBool explainRenderErrors = b(false, "explainRenderErrors",
Comments.explainRenderErrors);
public ConfigFloat fanParticleDensity = f(.5f, 0, 1, "fanParticleDensity",
public final ConfigFloat fanParticleDensity = f(.5f, 0, 1, "fanParticleDensity",
Comments.fanParticleDensity);
public ConfigFloat filterItemRenderDistance = f(10f, 1, "filterItemRenderDistance", Comments.filterItemRenderDistance);
public ConfigBool rainbowDebug = b(true, "enableRainbowDebug",
public final ConfigFloat filterItemRenderDistance = f(10f, 1, "filterItemRenderDistance", Comments.filterItemRenderDistance);
public final ConfigBool rainbowDebug = b(true, "enableRainbowDebug",
Comments.rainbowDebug);
public ConfigBool experimentalRendering = b(true, "experimentalRendering",
public final ConfigBool experimentalRendering = b(true, "experimentalRendering",
Comments.experimentalRendering);
public ConfigInt maxContraptionLightVolume = i(16384, 0, Integer.MAX_VALUE, "maximumContraptionLightVolume",
public final ConfigInt maxContraptionLightVolume = i(16384, 0, Integer.MAX_VALUE, "maximumContraptionLightVolume",
Comments.maxContraptionLightVolume);
// no group
public ConfigInt mainMenuConfigButtonRow = i(2, 0, 4, "mainMenuConfigButtonRow",
public final ConfigInt mainMenuConfigButtonRow = i(2, 0, 4, "mainMenuConfigButtonRow",
Comments.mainMenuConfigButtonRow);
public ConfigInt mainMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "mainMenuConfigButtonOffsetX",
public final ConfigInt mainMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "mainMenuConfigButtonOffsetX",
Comments.mainMenuConfigButtonOffsetX);
public ConfigInt ingameMenuConfigButtonRow = i(3, 0, 5, "ingameMenuConfigButtonRow",
public final ConfigInt ingameMenuConfigButtonRow = i(3, 0, 5, "ingameMenuConfigButtonRow",
Comments.ingameMenuConfigButtonRow);
public ConfigInt ingameMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "ingameMenuConfigButtonOffsetX",
public final ConfigInt ingameMenuConfigButtonOffsetX = i(-4, Integer.MIN_VALUE, Integer.MAX_VALUE, "ingameMenuConfigButtonOffsetX",
Comments.ingameMenuConfigButtonOffsetX);
public ConfigBool ignoreFabulousWarning = b(false, "ignoreFabulousWarning",
public final ConfigBool ignoreFabulousWarning = b(false, "ignoreFabulousWarning",
Comments.ignoreFabulousWarning);
//overlay group
public ConfigGroup overlay = group(1, "goggleOverlay",
public final ConfigGroup overlay = group(1, "goggleOverlay",
Comments.overlay);
public ConfigInt overlayOffsetX = i(20, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetX",
public final ConfigInt overlayOffsetX = i(20, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetX",
Comments.overlayOffset);
public ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY",
public final ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY",
Comments.overlayOffset);
public ConfigBool overlayCustomColor = b(false, "customColorsOverlay",
public final ConfigBool overlayCustomColor = b(false, "customColorsOverlay",
Comments.overlayCustomColor);
public ConfigInt overlayBackgroundColor = i(0xf0_100010, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBackgroundOverlay",
public final ConfigInt overlayBackgroundColor = i(0xf0_100010, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBackgroundOverlay",
Comments.overlayBackgroundColor);
public ConfigInt overlayBorderColorTop = i(0x50_5000ff, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBorderTopOverlay",
public final ConfigInt overlayBorderColorTop = i(0x50_5000ff, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBorderTopOverlay",
Comments.overlayBorderColorTop);
public ConfigInt overlayBorderColorBot = i(0x50_28007f, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBorderBotOverlay",
public final ConfigInt overlayBorderColorBot = i(0x50_28007f, Integer.MIN_VALUE, Integer.MAX_VALUE, "customBorderBotOverlay",
Comments.overlayBorderColorBot);
//placement assist group
public ConfigGroup placementAssist = group(1, "placementAssist",
public final ConfigGroup placementAssist = group(1, "placementAssist",
Comments.placementAssist);
public ConfigEnum<PlacementIndicatorSetting> placementIndicator = e(PlacementIndicatorSetting.TEXTURE, "indicatorType",
public final ConfigEnum<PlacementIndicatorSetting> placementIndicator = e(PlacementIndicatorSetting.TEXTURE, "indicatorType",
Comments.placementIndicator);
public ConfigFloat indicatorScale = f(1.0f, 0f, "indicatorScale",
public final ConfigFloat indicatorScale = f(1.0f, 0f, "indicatorScale",
Comments.indicatorScale);
//ponder group
public ConfigGroup ponder = group(1, "ponder",
public final ConfigGroup ponder = group(1, "ponder",
Comments.ponder);
public ConfigBool comfyReading = b(false, "comfyReading",
public final ConfigBool comfyReading = b(false, "comfyReading",
Comments.comfyReading);
//sound group
public ConfigGroup sound = group(1, "sound",
public final ConfigGroup sound = group(1, "sound",
Comments.sound);
public ConfigBool enableAmbientSounds = b(true, "enableAmbientSounds",
public final ConfigBool enableAmbientSounds = b(true, "enableAmbientSounds",
Comments.enableAmbientSounds);
public ConfigFloat ambientVolumeCap = f(.1f, 0, 1, "ambientVolumeCap",
public final ConfigFloat ambientVolumeCap = f(.1f, 0, 1, "ambientVolumeCap",
Comments.ambientVolumeCap);
@Override
@ -139,4 +139,5 @@ public class CClient extends ConfigBase {
static String enableAmbientSounds = "Make cogs rumble and machines clatter.";
static String ambientVolumeCap = "Maximum volume modifier of Ambient noise";
}
}

View file

@ -2,7 +2,7 @@ package com.simibubi.create.foundation.config;
public class CCommon extends ConfigBase {
public CWorldGen worldGen = nested(0, CWorldGen::new, Comments.worldGen);
public final CWorldGen worldGen = nested(0, CWorldGen::new, Comments.worldGen);
@Override
public String getName() {

View file

@ -2,14 +2,14 @@ package com.simibubi.create.foundation.config;
public class CCuriosities extends ConfigBase {
public ConfigInt maxSymmetryWandRange = i(50, 10, "maxSymmetryWandRange", Comments.symmetryRange);
public ConfigInt placementAssistRange = i(12, 3, "placementAssistRange", Comments.placementRange);
public ConfigInt toolboxRange = i(10, 1, "toolboxRange", Comments.toolboxRange);
public ConfigInt airInBacktank = i(900, 1, "airInBacktank", Comments.maxAirInBacktank);
public ConfigInt enchantedBacktankCapacity = i(300, 1, "enchantedBacktankCapacity", Comments.enchantedBacktankCapacity);
public final ConfigInt maxSymmetryWandRange = i(50, 10, "maxSymmetryWandRange", Comments.symmetryRange);
public final ConfigInt placementAssistRange = i(12, 3, "placementAssistRange", Comments.placementRange);
public final ConfigInt toolboxRange = i(10, 1, "toolboxRange", Comments.toolboxRange);
public final ConfigInt airInBacktank = i(900, 1, "airInBacktank", Comments.maxAirInBacktank);
public final ConfigInt enchantedBacktankCapacity = i(300, 1, "enchantedBacktankCapacity", Comments.enchantedBacktankCapacity);
public ConfigInt maxExtendoGripActions = i(1000, 0, "maxExtendoGripActions", Comments.maxExtendoGripActions);
public ConfigInt maxPotatoCannonShots = i(200, 0, "maxPotatoCannonShots", Comments.maxPotatoCannonShots);
public final ConfigInt maxExtendoGripActions = i(1000, 0, "maxExtendoGripActions", Comments.maxExtendoGripActions);
public final ConfigInt maxPotatoCannonShots = i(200, 0, "maxPotatoCannonShots", Comments.maxPotatoCannonShots);
// public ConfigInt zapperUndoLogLength = i(10, 0, "zapperUndoLogLength", Comments.zapperUndoLogLength); NYI
@ -32,7 +32,7 @@ public class CCuriosities extends ConfigBase {
"Amount of free Extendo Grip actions provided by one filled Copper Backtank. Set to 0 makes Extendo Grips unbreakable";
static String maxPotatoCannonShots =
"Amount of free Potato Cannon shots provided by one filled Copper Backtank. Set to 0 makes Potato Cannons unbreakable";
// static String zapperUndoLogLength = "The maximum amount of operations, a blockzapper can remember for undoing. (0 to disable undo)";
// static String zapperUndoLogLength = "The maximum amount of operations a blockzapper can remember for undoing. (0 to disable undo)";
}
}

View file

@ -2,15 +2,15 @@ package com.simibubi.create.foundation.config;
public class CFluids extends ConfigBase {
public ConfigInt fluidTankCapacity = i(8, 1, "fluidTankCapacity", Comments.buckets, Comments.fluidTankCapacity);
public ConfigInt fluidTankMaxHeight = i(32, 1, "fluidTankMaxHeight", Comments.blocks, Comments.fluidTankMaxHeight);
public ConfigInt mechanicalPumpRange =
public final ConfigInt fluidTankCapacity = i(8, 1, "fluidTankCapacity", Comments.buckets, Comments.fluidTankCapacity);
public final ConfigInt fluidTankMaxHeight = i(32, 1, "fluidTankMaxHeight", Comments.blocks, Comments.fluidTankMaxHeight);
public final ConfigInt mechanicalPumpRange =
i(16, 1, "mechanicalPumpRange", Comments.blocks, Comments.mechanicalPumpRange);
public ConfigInt hosePulleyBlockThreshold = i(10000, -1, "hosePulleyBlockThreshold", Comments.blocks,
public final ConfigInt hosePulleyBlockThreshold = i(10000, -1, "hosePulleyBlockThreshold", Comments.blocks,
Comments.toDisable, Comments.hosePulleyBlockThreshold);
public ConfigBool fillInfinite = b(false, "fillInfinite", Comments.fillInfinite);
public ConfigInt hosePulleyRange = i(128, 1, "hosePulleyRange", Comments.blocks, Comments.hosePulleyRange);
public final ConfigBool fillInfinite = b(false, "fillInfinite", Comments.fillInfinite);
public final ConfigInt hosePulleyRange = i(128, 1, "hosePulleyRange", Comments.blocks, Comments.hosePulleyRange);
@Override
public String getName() {

View file

@ -4,51 +4,51 @@ import com.simibubi.create.foundation.config.ui.ConfigAnnotations;
public class CKinetics extends ConfigBase {
public ConfigBool disableStress = b(false, "disableStress", Comments.disableStress);
public ConfigInt maxBeltLength = i(20, 5, "maxBeltLength", Comments.maxBeltLength);
public ConfigInt crushingDamage = i(4, 0, "crushingDamage", Comments.crushingDamage);
public ConfigInt maxMotorSpeed = i(256, 64, "maxMotorSpeed", Comments.rpm, Comments.maxMotorSpeed, ConfigAnnotations.RequiresRestart.BOTH.asComment());
public ConfigInt waterWheelBaseSpeed = i(4, 1, "waterWheelBaseSpeed", Comments.rpm, Comments.waterWheelBaseSpeed);
public ConfigInt waterWheelFlowSpeed = i(4, 1, "waterWheelFlowSpeed", Comments.rpm, Comments.waterWheelFlowSpeed);
public ConfigInt furnaceEngineSpeed = i(16, 1, "furnaceEngineSpeed", Comments.rpm, Comments.furnaceEngineSpeed);
public ConfigInt maxRotationSpeed = i(256, 64, "maxRotationSpeed", Comments.rpm, Comments.maxRotationSpeed);
public ConfigEnum<DeployerAggroSetting> ignoreDeployerAttacks =
public final ConfigBool disableStress = b(false, "disableStress", Comments.disableStress);
public final ConfigInt maxBeltLength = i(20, 5, "maxBeltLength", Comments.maxBeltLength);
public final ConfigInt crushingDamage = i(4, 0, "crushingDamage", Comments.crushingDamage);
public final ConfigInt maxMotorSpeed = i(256, 64, "maxMotorSpeed", Comments.rpm, Comments.maxMotorSpeed, ConfigAnnotations.RequiresRestart.BOTH.asComment());
public final ConfigInt waterWheelBaseSpeed = i(4, 1, "waterWheelBaseSpeed", Comments.rpm, Comments.waterWheelBaseSpeed);
public final ConfigInt waterWheelFlowSpeed = i(4, 1, "waterWheelFlowSpeed", Comments.rpm, Comments.waterWheelFlowSpeed);
public final ConfigInt furnaceEngineSpeed = i(16, 1, "furnaceEngineSpeed", Comments.rpm, Comments.furnaceEngineSpeed);
public final ConfigInt maxRotationSpeed = i(256, 64, "maxRotationSpeed", Comments.rpm, Comments.maxRotationSpeed);
public final ConfigEnum<DeployerAggroSetting> ignoreDeployerAttacks =
e(DeployerAggroSetting.CREEPERS, "ignoreDeployerAttacks", Comments.ignoreDeployerAttacks);
public ConfigInt kineticValidationFrequency =
public final ConfigInt kineticValidationFrequency =
i(60, 5, "kineticValidationFrequency", Comments.kineticValidationFrequency);
public ConfigFloat crankHungerMultiplier = f(.01f, 0, 1, "crankHungerMultiplier", Comments.crankHungerMultiplier);
public ConfigInt minimumWindmillSails = i(8, 0, "minimumWindmillSails", Comments.minimumWindmillSails);
public ConfigInt windmillSailsPerRPM = i(8, 1, "windmillSailsPerRPM", Comments.windmillSailsPerRPM);
public ConfigInt maxEjectorDistance = i(32, 0, "maxEjectorDistance", Comments.maxEjectorDistance);
public ConfigInt ejectorScanInterval = i(120, 10, "ejectorScanInterval", Comments.ejectorScanInterval);
public final ConfigFloat crankHungerMultiplier = f(.01f, 0, 1, "crankHungerMultiplier", Comments.crankHungerMultiplier);
public final ConfigInt minimumWindmillSails = i(8, 0, "minimumWindmillSails", Comments.minimumWindmillSails);
public final ConfigInt windmillSailsPerRPM = i(8, 1, "windmillSailsPerRPM", Comments.windmillSailsPerRPM);
public final ConfigInt maxEjectorDistance = i(32, 0, "maxEjectorDistance", Comments.maxEjectorDistance);
public final ConfigInt ejectorScanInterval = i(120, 10, "ejectorScanInterval", Comments.ejectorScanInterval);
public ConfigGroup fan = group(1, "encasedFan", "Encased Fan");
public ConfigInt fanPushDistance = i(20, 5, "fanPushDistance", Comments.fanPushDistance);
public ConfigInt fanPullDistance = i(20, 5, "fanPullDistance", Comments.fanPullDistance);
public ConfigInt fanBlockCheckRate = i(30, 10, "fanBlockCheckRate", Comments.fanBlockCheckRate);
public ConfigInt fanRotationArgmax = i(256, 64, "fanRotationArgmax", Comments.rpm, Comments.fanRotationArgmax);
public ConfigInt generatingFanSpeed = i(4, 0, "generatingFanSpeed", Comments.rpm, Comments.generatingFanSpeed);
public ConfigInt inWorldProcessingTime = i(150, 0, "inWorldProcessingTime", Comments.inWorldProcessingTime);
public final ConfigGroup fan = group(1, "encasedFan", "Encased Fan");
public final ConfigInt fanPushDistance = i(20, 5, "fanPushDistance", Comments.fanPushDistance);
public final ConfigInt fanPullDistance = i(20, 5, "fanPullDistance", Comments.fanPullDistance);
public final ConfigInt fanBlockCheckRate = i(30, 10, "fanBlockCheckRate", Comments.fanBlockCheckRate);
public final ConfigInt fanRotationArgmax = i(256, 64, "fanRotationArgmax", Comments.rpm, Comments.fanRotationArgmax);
public final ConfigInt generatingFanSpeed = i(4, 0, "generatingFanSpeed", Comments.rpm, Comments.generatingFanSpeed);
public final ConfigInt inWorldProcessingTime = i(150, 0, "inWorldProcessingTime", Comments.inWorldProcessingTime);
public ConfigGroup contraptions = group(1, "contraptions", "Moving Contraptions");
public ConfigInt maxBlocksMoved = i(2048, 1, "maxBlocksMoved", Comments.maxBlocksMoved);
public ConfigInt maxChassisRange = i(16, 1, "maxChassisRange", Comments.maxChassisRange);
public ConfigInt maxPistonPoles = i(64, 1, "maxPistonPoles", Comments.maxPistonPoles);
public ConfigInt maxRopeLength = i(128, 1, "maxRopeLength", Comments.maxRopeLength);
public ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength);
public ConfigEnum<SpawnerMovementSetting> spawnerMovement =
public final ConfigGroup contraptions = group(1, "contraptions", "Moving Contraptions");
public final ConfigInt maxBlocksMoved = i(2048, 1, "maxBlocksMoved", Comments.maxBlocksMoved);
public final ConfigInt maxChassisRange = i(16, 1, "maxChassisRange", Comments.maxChassisRange);
public final ConfigInt maxPistonPoles = i(64, 1, "maxPistonPoles", Comments.maxPistonPoles);
public final ConfigInt maxRopeLength = i(128, 1, "maxRopeLength", Comments.maxRopeLength);
public final ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength);
public final ConfigEnum<SpawnerMovementSetting> spawnerMovement =
e(SpawnerMovementSetting.NO_PICKUP, "movableSpawners", Comments.spawnerMovement);
public CStress stressValues = nested(1, CStress::new, Comments.stress);
public final CStress stressValues = nested(1, CStress::new, Comments.stress);
public ConfigGroup state = group(1, "stats", Comments.stats);
public ConfigFloat mediumSpeed = f(30, 0, 4096, "mediumSpeed", Comments.rpm, Comments.mediumSpeed);
public ConfigFloat fastSpeed = f(100, 0, 65535, "fastSpeed", Comments.rpm, Comments.fastSpeed);
public ConfigFloat mediumStressImpact =
public final ConfigGroup state = group(1, "stats", Comments.stats);
public final ConfigFloat mediumSpeed = f(30, 0, 4096, "mediumSpeed", Comments.rpm, Comments.mediumSpeed);
public final ConfigFloat fastSpeed = f(100, 0, 65535, "fastSpeed", Comments.rpm, Comments.fastSpeed);
public final ConfigFloat mediumStressImpact =
f(4, 0, 4096, "mediumStressImpact", Comments.su, Comments.mediumStressImpact);
public ConfigFloat highStressImpact = f(8, 0, 65535, "highStressImpact", Comments.su, Comments.highStressImpact);
public ConfigFloat mediumCapacity = f(128, 0, 4096, "mediumCapacity", Comments.su, Comments.mediumCapacity);
public ConfigFloat highCapacity = f(512, 0, 65535, "highCapacity", Comments.su, Comments.highCapacity);
public final ConfigFloat highStressImpact = f(8, 0, 65535, "highStressImpact", Comments.su, Comments.highStressImpact);
public final ConfigFloat mediumCapacity = f(128, 0, 4096, "mediumCapacity", Comments.su, Comments.mediumCapacity);
public final ConfigFloat highCapacity = f(512, 0, 65535, "highCapacity", Comments.su, Comments.highCapacity);
@Override
public String getName() {

View file

@ -2,11 +2,11 @@ package com.simibubi.create.foundation.config;
public class CLogistics extends ConfigBase {
public ConfigInt defaultExtractionLimit = i(64, 1, 64, "defaultExtractionLimit", Comments.defaultExtractionLimit);
public ConfigInt defaultExtractionTimer = i(8, 1, "defaultExtractionTimer", Comments.defaultExtractionTimer);
public ConfigInt psiTimeout = i(20, 1, "psiTimeout", Comments.psiTimeout);
public ConfigInt mechanicalArmRange = i(5, 1, "mechanicalArmRange", Comments.mechanicalArmRange);
public ConfigInt linkRange = i(128, 1, "linkRange", Comments.linkRange);
public final ConfigInt defaultExtractionLimit = i(64, 1, 64, "defaultExtractionLimit", Comments.defaultExtractionLimit);
public final ConfigInt defaultExtractionTimer = i(8, 1, "defaultExtractionTimer", Comments.defaultExtractionTimer);
public final ConfigInt psiTimeout = i(20, 1, "psiTimeout", Comments.psiTimeout);
public final ConfigInt mechanicalArmRange = i(5, 1, "mechanicalArmRange", Comments.mechanicalArmRange);
public final ConfigInt linkRange = i(128, 1, "linkRange", Comments.linkRange);
@Override
public String getName() {

View file

@ -2,22 +2,22 @@ package com.simibubi.create.foundation.config;
public class CRecipes extends ConfigBase {
public ConfigBool bulkPressing = b(false, "bulkPressing", Comments.bulkPressing);
public ConfigBool bulkCutting = b(false, "bulkCutting", Comments.bulkCutting);
public ConfigBool allowShapelessInMixer = b(true, "allowShapelessInMixer", Comments.allowShapelessInMixer);
public ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
public ConfigBool allowRegularCraftingInCrafter =
public final ConfigBool bulkPressing = b(false, "bulkPressing", Comments.bulkPressing);
public final ConfigBool bulkCutting = b(false, "bulkCutting", Comments.bulkCutting);
public final ConfigBool allowShapelessInMixer = b(true, "allowShapelessInMixer", Comments.allowShapelessInMixer);
public final ConfigBool allowShapedSquareInPress = b(true, "allowShapedSquareInPress", Comments.allowShapedSquareInPress);
public final ConfigBool allowRegularCraftingInCrafter =
b(true, "allowRegularCraftingInCrafter", Comments.allowRegularCraftingInCrafter);
public ConfigBool allowBiggerFireworksInCrafter =
public final ConfigBool allowBiggerFireworksInCrafter =
b(false, "allowBiggerFireworksInCrafter", Comments.allowBiggerFireworksInCrafter);
public ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
public ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
public ConfigBool allowCastingBySpout = b(true, "allowCastingBySpout", Comments.allowCastingBySpout);
public ConfigInt lightSourceCountForRefinedRadiance =
public final ConfigBool allowStonecuttingOnSaw = b(true, "allowStonecuttingOnSaw", Comments.allowStonecuttingOnSaw);
public final ConfigBool allowWoodcuttingOnSaw = b(true, "allowWoodcuttingOnSaw", Comments.allowWoodcuttingOnSaw);
public final ConfigBool allowCastingBySpout = b(true, "allowCastingBySpout", Comments.allowCastingBySpout);
public final ConfigInt lightSourceCountForRefinedRadiance =
i(10, 1, "lightSourceCountForRefinedRadiance", Comments.refinedRadiance);
public ConfigBool enableRefinedRadianceRecipe =
public final ConfigBool enableRefinedRadianceRecipe =
b(true, "enableRefinedRadianceRecipe", Comments.refinedRadianceRecipe);
public ConfigBool enableShadowSteelRecipe = b(true, "enableShadowSteelRecipe", Comments.shadowSteelRecipe);
public final ConfigBool enableShadowSteelRecipe = b(true, "enableShadowSteelRecipe", Comments.shadowSteelRecipe);
@Override
public String getName() {

View file

@ -2,19 +2,19 @@ package com.simibubi.create.foundation.config;
public class CSchematics extends ConfigBase {
public ConfigBool creativePrintIncludesAir = b(false, "creativePrintIncludesAir", Comments.creativePrintIncludesAir);
public ConfigInt maxSchematics = i(10, 1, "maxSchematics", Comments.maxSchematics);
public ConfigInt maxTotalSchematicSize = i(256, 16, "maxSchematics", Comments.kb, Comments.maxSize);
public ConfigInt maxSchematicPacketSize =
public final ConfigBool creativePrintIncludesAir = b(false, "creativePrintIncludesAir", Comments.creativePrintIncludesAir);
public final ConfigInt maxSchematics = i(10, 1, "maxSchematics", Comments.maxSchematics);
public final ConfigInt maxTotalSchematicSize = i(256, 16, "maxSchematics", Comments.kb, Comments.maxSize);
public final ConfigInt maxSchematicPacketSize =
i(1024, 256, 32767, "maxSchematicPacketSize", Comments.b, Comments.maxPacketSize);
public ConfigInt schematicIdleTimeout = i(600, 100, "schematicIdleTimeout", Comments.idleTimeout);
public final ConfigInt schematicIdleTimeout = i(600, 100, "schematicIdleTimeout", Comments.idleTimeout);
public ConfigGroup schematicannon = group(0, "schematicannon", "Schematicannon");
public ConfigInt schematicannonDelay = i(10, 1, "schematicannonDelay", Comments.delay);
public ConfigInt schematicannonSkips = i(10, 1, "schematicannonSkips", Comments.skips);
public ConfigFloat schematicannonGunpowderWorth =
public final ConfigGroup schematicannon = group(0, "schematicannon", "Schematicannon");
public final ConfigInt schematicannonDelay = i(10, 1, "schematicannonDelay", Comments.delay);
public final ConfigInt schematicannonSkips = i(10, 1, "schematicannonSkips", Comments.skips);
public final ConfigFloat schematicannonGunpowderWorth =
f(20, 0, 100, "schematicannonGunpowderWorth", Comments.gunpowderWorth);
public ConfigFloat schematicannonFuelUsage = f(0.05f, 0, 100, "schematicannonFuelUsage", Comments.fuelUsage);
public final ConfigFloat schematicannonFuelUsage = f(0.05f, 0, 100, "schematicannonFuelUsage", Comments.fuelUsage);
@Override
public String getName() {

View file

@ -2,16 +2,16 @@ package com.simibubi.create.foundation.config;
public class CServer extends ConfigBase {
public ConfigGroup infrastructure = group(0, "infrastructure", Comments.infrastructure);
public ConfigInt tickrateSyncTimer =
public final ConfigGroup infrastructure = group(0, "infrastructure", Comments.infrastructure);
public final ConfigInt tickrateSyncTimer =
i(20, 5, "tickrateSyncTimer", "[in Ticks]", Comments.tickrateSyncTimer, Comments.tickrateSyncTimer2);
public CRecipes recipes = nested(0, CRecipes::new, Comments.recipes);
public CKinetics kinetics = nested(0, CKinetics::new, Comments.kinetics);
public CFluids fluids = nested(0, CFluids::new, Comments.fluids);
public CLogistics logistics = nested(0, CLogistics::new, Comments.logistics);
public CSchematics schematics = nested(0, CSchematics::new, Comments.schematics);
public CCuriosities curiosities = nested(0, CCuriosities::new, Comments.curiosities);
public final CRecipes recipes = nested(0, CRecipes::new, Comments.recipes);
public final CKinetics kinetics = nested(0, CKinetics::new, Comments.kinetics);
public final CFluids fluids = nested(0, CFluids::new, Comments.fluids);
public final CLogistics logistics = nested(0, CLogistics::new, Comments.logistics);
public final CSchematics schematics = nested(0, CSchematics::new, Comments.schematics);
public final CCuriosities curiosities = nested(0, CCuriosities::new, Comments.curiosities);
@Override
public String getName() {

View file

@ -16,8 +16,8 @@ import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
public class CStress extends ConfigBase implements IStressValueProvider {
private Map<ResourceLocation, ConfigValue<Double>> capacities = new HashMap<>();
private Map<ResourceLocation, ConfigValue<Double>> impacts = new HashMap<>();
private final Map<ResourceLocation, ConfigValue<Double>> capacities = new HashMap<>();
private final Map<ResourceLocation, ConfigValue<Double>> impacts = new HashMap<>();
@Override
protected void registerAll(Builder builder) {
@ -62,12 +62,14 @@ public class CStress extends ConfigBase implements IStressValueProvider {
return 0;
}
@Override
public boolean hasImpact(Block block) {
block = redirectValues(block);
ResourceLocation key = block.getRegistryName();
return getImpacts().containsKey(key);
}
@Override
public boolean hasCapacity(Block block) {
block = redirectValues(block);
ResourceLocation key = block.getRegistryName();

View file

@ -6,7 +6,7 @@ import net.minecraftforge.common.ForgeConfigSpec.Builder;
public class CWorldGen extends ConfigBase {
public ConfigBool disable = b(false, "disableWorldGen", Comments.disable);
public final ConfigBool disable = b(false, "disableWorldGen", Comments.disable);
@Override
protected void registerAll(Builder builder) {

View file

@ -19,7 +19,7 @@ import com.simibubi.create.foundation.block.connected.CTModel;
import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour;
import com.simibubi.create.foundation.block.render.ColoredVertexModel;
import com.simibubi.create.foundation.block.render.IBlockVertexColor;
import com.simibubi.create.foundation.item.render.CustomRenderedItemModel;
import com.simibubi.create.foundation.item.render.CustomRenderedItemModelRenderer;
import com.tterrag.registrate.AbstractRegistrate;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.Builder;
@ -36,6 +36,7 @@ import com.tterrag.registrate.util.nullness.NonNullUnaryOperator;
import net.minecraft.block.AbstractBlock.Properties;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
@ -216,11 +217,14 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
}
public static <T extends Item, P> NonNullUnaryOperator<ItemBuilder<T, P>> customRenderedItem(
Supplier<NonNullFunction<IBakedModel, ? extends CustomRenderedItemModel>> func) {
return b -> b.properties(p -> p.setISTER(() -> () -> func.get()
.apply(null)
.createRenderer()))
.onRegister(entry -> onClient(() -> () -> registerCustomRenderedItem(entry, func)));
Supplier<Supplier<CustomRenderedItemModelRenderer<?>>> supplier) {
return b -> b.properties(p -> p.setISTER(() -> () -> supplier.get().get()))
.onRegister(entry -> onClient(() -> () -> {
ItemStackTileEntityRenderer ister = entry.getItemStackTileEntityRenderer();
if (ister instanceof CustomRenderedItemModelRenderer) {
registerCustomRenderedItem(entry, (CustomRenderedItemModelRenderer<?>) ister);
}
}));
}
protected static void onClient(Supplier<Runnable> toRun) {
@ -229,41 +233,41 @@ public class CreateRegistrate extends AbstractRegistrate<CreateRegistrate> {
@OnlyIn(Dist.CLIENT)
private static void registerCTBehviour(Block entry, ConnectedTextureBehaviour behavior) {
CreateClient.getCustomBlockModels()
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
.register(entry.delegate, model -> new CTModel(model, behavior));
}
@OnlyIn(Dist.CLIENT)
private static <T extends Block> void registerCasingConnectivity(T entry,
BiConsumer<T, CasingConnectivity> consumer) {
consumer.accept(entry, CreateClient.getCasingConnectivity());
consumer.accept(entry, CreateClient.CASING_CONNECTIVITY);
}
@OnlyIn(Dist.CLIENT)
private static void registerBlockVertexColor(Block entry, IBlockVertexColor colorFunc) {
CreateClient.getCustomBlockModels()
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
.register(entry.delegate, model -> new ColoredVertexModel(model, colorFunc));
}
@OnlyIn(Dist.CLIENT)
private static void registerBlockModel(Block entry,
Supplier<NonNullFunction<IBakedModel, ? extends IBakedModel>> func) {
CreateClient.getCustomBlockModels()
CreateClient.MODEL_SWAPPER.getCustomBlockModels()
.register(entry.delegate, func.get());
}
@OnlyIn(Dist.CLIENT)
private static void registerItemModel(Item entry,
Supplier<NonNullFunction<IBakedModel, ? extends IBakedModel>> func) {
CreateClient.getCustomItemModels()
CreateClient.MODEL_SWAPPER.getCustomItemModels()
.register(entry.delegate, func.get());
}
@OnlyIn(Dist.CLIENT)
private static void registerCustomRenderedItem(Item entry,
Supplier<NonNullFunction<IBakedModel, ? extends CustomRenderedItemModel>> func) {
CreateClient.getCustomRenderedItems()
.register(entry.delegate, func.get());
CustomRenderedItemModelRenderer<?> renderer) {
CreateClient.MODEL_SWAPPER.getCustomRenderedItems()
.register(entry.delegate, renderer::createModel);
}
}

View file

@ -23,7 +23,6 @@ import com.simibubi.create.AllTags.AllItemTags;
import com.simibubi.create.Create;
import com.simibubi.create.content.AllSections;
import com.simibubi.create.content.palettes.AllPaletteBlocks;
import com.simibubi.create.foundation.data.recipe.CreateRecipeProvider.I;
import com.simibubi.create.foundation.utility.Lang;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.entry.ItemEntry;

View file

@ -6,7 +6,7 @@ import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.matrix.MatrixStack.Entry;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.foundation.renderState.RenderTypes;
import com.simibubi.create.foundation.render.RenderTypes;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.Iterate;

View file

@ -29,7 +29,7 @@ public class CustomItemModels {
registered.add(Pair.of(entry, behaviour));
}
public void foreach(NonNullBiConsumer<Item, NonNullFunction<IBakedModel, ? extends IBakedModel>> consumer) {
public void forEach(NonNullBiConsumer<Item, NonNullFunction<IBakedModel, ? extends IBakedModel>> consumer) {
loadEntriesIfMissing();
customModels.forEach(consumer);
}

View file

@ -10,23 +10,21 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ModelRotation;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.model.BakedModelWrapper;
import net.minecraftforge.client.model.ModelLoader;
public abstract class CustomRenderedItemModel extends BakedModelWrapper<IBakedModel> {
protected String namespace;
protected String basePath;
protected Map<String, IBakedModel> partials = new HashMap<>();
protected ItemStackTileEntityRenderer renderer;
public CustomRenderedItemModel(IBakedModel template, String namespace, String basePath) {
super(template);
this.namespace = namespace;
this.basePath = basePath;
this.renderer = createRenderer();
}
@Override
@ -36,7 +34,8 @@ public abstract class CustomRenderedItemModel extends BakedModelWrapper<IBakedMo
@Override
public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) {
// Super call returns originalModel, but we want to return this, else ISTER won't be used.
// Super call returns originalModel, but we want to return this, else ISTER
// won't be used.
super.handlePerspective(cameraTransformType, mat);
return this;
}
@ -45,39 +44,32 @@ public abstract class CustomRenderedItemModel extends BakedModelWrapper<IBakedMo
return originalModel;
}
public ItemStackTileEntityRenderer getRenderer() {
return renderer;
public IBakedModel getPartial(String name) {
return partials.get(name);
}
public abstract ItemStackTileEntityRenderer createRenderer();
public final List<ResourceLocation> getModelLocations() {
return partials.keySet().stream().map(this::getPartialModelLocation).collect(Collectors.toList());
}
protected void addPartials(String... partials) {
this.partials.clear();
for (String name : partials)
this.partials.put(name, null);
}
public CustomRenderedItemModel loadPartials(ModelBakeEvent event) {
public void loadPartials(ModelBakeEvent event) {
ModelLoader modelLoader = event.getModelLoader();
for (String name : partials.keySet())
partials.put(name, loadModel(event, name));
return this;
partials.put(name, loadPartial(modelLoader, name));
}
@SuppressWarnings("deprecation")
private IBakedModel loadModel(ModelBakeEvent event, String name) {
return event.getModelLoader().bake(getPartialModelLocation(name), ModelRotation.X0_Y0);
protected IBakedModel loadPartial(ModelLoader modelLoader, String name) {
return modelLoader.bake(getPartialModelLocation(name), ModelRotation.X0_Y0);
}
private ResourceLocation getPartialModelLocation(String name) {
protected ResourceLocation getPartialModelLocation(String name) {
return new ResourceLocation(namespace, "item/" + basePath + "/" + name);
}
public IBakedModel getPartial(String name) {
return partials.get(name);
}
}

View file

@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.ItemStack;
@ -13,9 +14,9 @@ public abstract class CustomRenderedItemModelRenderer<M extends CustomRenderedIt
@Override
@SuppressWarnings("unchecked")
public void renderByItem(ItemStack stack, ItemCameraTransforms.TransformType transformType, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
M mainModel = ((M) Minecraft.getInstance()
M mainModel = (M) Minecraft.getInstance()
.getItemRenderer()
.getModel(stack, null, null));
.getModel(stack, null, null);
PartialItemModelRenderer renderer = PartialItemModelRenderer.of(stack, transformType, ms, buffer, overlay);
ms.pushPose();
@ -27,4 +28,6 @@ public abstract class CustomRenderedItemModelRenderer<M extends CustomRenderedIt
protected abstract void render(ItemStack stack, M model, PartialItemModelRenderer renderer, ItemCameraTransforms.TransformType transformType,
MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay);
public abstract M createModel(IBakedModel originalModel);
}

View file

@ -29,7 +29,7 @@ public class CustomRenderedItems {
registered.add(Pair.of(entry, behaviour));
}
public void foreach(
public void forEach(
NonNullBiConsumer<Item, NonNullFunction<IBakedModel, ? extends CustomRenderedItemModel>> consumer) {
loadEntriesIfMissing();
customModels.forEach(consumer);

View file

@ -4,7 +4,7 @@ import java.util.Random;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.foundation.renderState.RenderTypes;
import com.simibubi.create.foundation.render.RenderTypes;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.client.Minecraft;
@ -20,27 +20,23 @@ import net.minecraftforge.client.model.data.IModelData;
public class PartialItemModelRenderer {
static PartialItemModelRenderer instance;
private static final PartialItemModelRenderer INSTANCE = new PartialItemModelRenderer();
ItemStack stack;
int overlay;
MatrixStack ms;
ItemCameraTransforms.TransformType transformType;
IRenderTypeBuffer buffer;
private final Random random = new Random();
static PartialItemModelRenderer get() {
if (instance == null)
instance = new PartialItemModelRenderer();
return instance;
}
private ItemStack stack;
private ItemCameraTransforms.TransformType transformType;
private MatrixStack ms;
private IRenderTypeBuffer buffer;
private int overlay;
public static PartialItemModelRenderer of(ItemStack stack, ItemCameraTransforms.TransformType transformType,
MatrixStack ms, IRenderTypeBuffer buffer, int overlay) {
PartialItemModelRenderer instance = get();
PartialItemModelRenderer instance = INSTANCE;
instance.stack = stack;
instance.buffer = buffer;
instance.ms = ms;
instance.transformType = transformType;
instance.ms = ms;
instance.buffer = buffer;
instance.overlay = overlay;
return instance;
}
@ -79,20 +75,19 @@ public class PartialItemModelRenderer {
ms.popPose();
}
private void renderBakedItemModel(IBakedModel model, int light, MatrixStack ms, IVertexBuilder p_229114_6_) {
private void renderBakedItemModel(IBakedModel model, int light, MatrixStack ms, IVertexBuilder buffer) {
ItemRenderer ir = Minecraft.getInstance()
.getItemRenderer();
Random random = new Random();
IModelData data = EmptyModelData.INSTANCE;
for (Direction direction : Iterate.directions) {
random.setSeed(42L);
ir.renderQuadList(ms, p_229114_6_, model.getQuads(null, direction, random, data), stack, light,
ir.renderQuadList(ms, buffer, model.getQuads(null, direction, random, data), stack, light,
overlay);
}
random.setSeed(42L);
ir.renderQuadList(ms, p_229114_6_, model.getQuads(null, null, random, data), stack, light, overlay);
ir.renderQuadList(ms, buffer, model.getQuads(null, null, random, data), stack, light, overlay);
}
}

View file

@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.simibubi.create.foundation.BreakProgressHook;
import com.simibubi.create.foundation.block.BreakProgressHook;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.world.ClientWorld;

View file

@ -26,7 +26,7 @@ import com.simibubi.create.foundation.ponder.elements.PonderOverlayElement;
import com.simibubi.create.foundation.ponder.elements.PonderSceneElement;
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.ponder.instructions.HideAllInstruction;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.Pair;
import com.simibubi.create.foundation.utility.VecHelper;

View file

@ -29,7 +29,7 @@ import com.simibubi.create.foundation.ponder.content.PonderTag;
import com.simibubi.create.foundation.ponder.content.PonderTagScreen;
import com.simibubi.create.foundation.ponder.elements.TextWindowElement;
import com.simibubi.create.foundation.ponder.ui.PonderButton;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.FontHelper;

View file

@ -14,7 +14,7 @@ import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
import com.simibubi.create.content.schematics.SchematicWorld;
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedClientWorld;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.foundation.renderState;
package com.simibubi.create.foundation.render;
import org.lwjgl.opengl.GL11;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.foundation.renderState;
package com.simibubi.create.foundation.render;
import java.util.SortedMap;

View file

@ -3,7 +3,7 @@ package com.simibubi.create.foundation.tileEntity.behaviour;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.logistics.item.filter.FilterItem;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform.Sided;
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions;
import com.simibubi.create.foundation.utility.Color;

View file

@ -90,7 +90,7 @@ public class SmartFluidTankBehaviour extends TileEntityBehaviour {
super.initialize();
if (getWorld().isClientSide)
return;
foreach(ts -> {
forEach(ts -> {
ts.fluidLevel.forceNextSync();
ts.onFluidStackChanged();
});
@ -106,7 +106,7 @@ public class SmartFluidTankBehaviour extends TileEntityBehaviour {
updateFluids();
}
foreach(te -> {
forEach(te -> {
LerpedFloat fluidLevel = te.getFluidLevel();
if (fluidLevel != null)
fluidLevel.tickChaser();
@ -160,7 +160,7 @@ public class SmartFluidTankBehaviour extends TileEntityBehaviour {
return true;
}
public void foreach(Consumer<TankSegment> action) {
public void forEach(Consumer<TankSegment> action) {
for (TankSegment tankSegment : tanks)
action.accept(tankSegment);
}
@ -173,7 +173,7 @@ public class SmartFluidTankBehaviour extends TileEntityBehaviour {
public void write(CompoundNBT nbt, boolean clientPacket) {
super.write(nbt, clientPacket);
ListNBT tanksNBT = new ListNBT();
foreach(ts -> tanksNBT.add(ts.writeNBT()));
forEach(ts -> tanksNBT.add(ts.writeNBT()));
nbt.put(getType().getName() + "Tanks", tanksNBT);
}

View file

@ -83,9 +83,12 @@ public class ScrollValueHandler {
@OnlyIn(Dist.CLIENT)
public static void tick() {
lastPassiveScroll = passiveScroll;
wrenchCog.tick();
passiveScroll += passiveScrollDirection * 0.5;
if (!Minecraft.getInstance()
.isPaused()) {
lastPassiveScroll = passiveScroll;
wrenchCog.tick();
passiveScroll += passiveScrollDirection * 0.5;
}
}
protected static void applyTo(double delta, ScrollValueBehaviour scrolling) {

View file

@ -0,0 +1,94 @@
package com.simibubi.create.foundation.utility;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import com.simibubi.create.foundation.block.render.CustomBlockModels;
import com.simibubi.create.foundation.item.render.CustomItemModels;
import com.simibubi.create.foundation.item.render.CustomRenderedItemModel;
import com.simibubi.create.foundation.item.render.CustomRenderedItems;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.eventbus.api.IEventBus;
public class ModelSwapper {
protected CustomBlockModels customBlockModels = new CustomBlockModels();
protected CustomItemModels customItemModels = new CustomItemModels();
protected CustomRenderedItems customRenderedItems = new CustomRenderedItems();
public CustomBlockModels getCustomBlockModels() {
return customBlockModels;
}
public CustomItemModels getCustomItemModels() {
return customItemModels;
}
public CustomRenderedItems getCustomRenderedItems() {
return customRenderedItems;
}
public void onModelRegistry(ModelRegistryEvent event) {
customRenderedItems.forEach((item, modelFunc) -> modelFunc.apply(null)
.getModelLocations()
.forEach(ModelLoader::addSpecialModel));
}
public void onModelBake(ModelBakeEvent event) {
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
customBlockModels.forEach((block, modelFunc) -> swapModels(modelRegistry, getAllBlockStateModelLocations(block), modelFunc));
customItemModels.forEach((item, modelFunc) -> swapModels(modelRegistry, getItemModelLocation(item), modelFunc));
customRenderedItems.forEach((item, modelFunc) -> {
swapModels(modelRegistry, getItemModelLocation(item), m -> {
CustomRenderedItemModel swapped = modelFunc.apply(m);
swapped.loadPartials(event);
return swapped;
});
});
}
public void registerListeners(IEventBus modEventBus) {
modEventBus.addListener(this::onModelRegistry);
modEventBus.addListener(this::onModelBake);
}
public static <T extends IBakedModel> void swapModels(Map<ResourceLocation, IBakedModel> modelRegistry,
List<ModelResourceLocation> locations, Function<IBakedModel, T> factory) {
locations.forEach(location -> {
swapModels(modelRegistry, location, factory);
});
}
public static <T extends IBakedModel> void swapModels(Map<ResourceLocation, IBakedModel> modelRegistry,
ModelResourceLocation location, Function<IBakedModel, T> factory) {
modelRegistry.put(location, factory.apply(modelRegistry.get(location)));
}
public static List<ModelResourceLocation> getAllBlockStateModelLocations(Block block) {
List<ModelResourceLocation> models = new ArrayList<>();
ResourceLocation blockRl = block.getRegistryName();
block.getStateDefinition()
.getPossibleStates()
.forEach(state -> {
models.add(BlockModelShapes.stateToModelLocation(blockRl, state));
});
return models;
}
public static ModelResourceLocation getItemModelLocation(Item item) {
return new ModelResourceLocation(item.getRegistryName(), "inventory");
}
}

View file

@ -13,7 +13,7 @@ import org.lwjgl.system.MemoryStack;
import com.jozufozu.flywheel.util.VirtualEmptyModelData;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
import net.minecraft.block.BlockState;

View file

@ -4,7 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.MathHelper;

View file

@ -2,8 +2,8 @@ package com.simibubi.create.foundation.utility.outliner;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.foundation.renderState.RenderTypes;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.RenderTypes;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;

View file

@ -9,8 +9,8 @@ import java.util.Set;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.foundation.renderState.RenderTypes;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.RenderTypes;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.client.renderer.RenderType;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.foundation.utility.outliner;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.foundation.utility.outliner;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector3d;

View file

@ -9,8 +9,8 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.matrix.MatrixStack.Entry;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.foundation.renderState.RenderTypes;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.RenderTypes;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.VecHelper;

View file

@ -8,7 +8,7 @@ import java.util.Optional;
import java.util.Set;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBox;
import com.simibubi.create.foundation.utility.outliner.LineOutline.EndChasingLineOutline;
import com.simibubi.create.foundation.utility.outliner.Outline.OutlineParams;