Initial 1.19.3 port.
This commit is contained in:
parent
1e2c8fe7eb
commit
96a6f15c65
16 changed files with 101 additions and 84 deletions
|
@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx8G
|
|||
meta_modid=engineersdecor
|
||||
meta_issues=https://github.com/stfwi/engineers-decor/issues
|
||||
meta_download=https://www.curseforge.com/minecraft/mc-mods/engineers-decor/
|
||||
version_minecraft=1.19.2
|
||||
version_forge_minecraft=1.19.2-43.1.16
|
||||
version_minecraft=1.19.3
|
||||
version_forge_minecraft=1.19.3-44.0.11
|
||||
version_jei=11.3.0.262
|
||||
version_engineersdecor=1.3.28
|
||||
version_engineersdecor=1.4.28
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
|
||||
"1.19.2": {
|
||||
"1.19.3": {
|
||||
"1.4.28": "[U] Initial 1.19.3 port.\n[B] Known issue: Creative tab missing (currently using \"Building Blocks\").",
|
||||
"1.3.28": "[F] Steel Mesh Fence help typo fixed (issue #227, ty shrad).\n[A] Added \"tree_cutter_universal_logs\" server config to enable chopping of modded resource wood blocks (e.g. rubber, issue #228).",
|
||||
"1.3.27": "[F] Refactored deprecated forge capability references.\n[F] Fixed Factory Hopper on-break item retention bug (issue #226, ty sunekaer/ftb).",
|
||||
"1.3.26": "[U] Ported to 1.19.2.\n[F] Fixed Mineral Melting Furnace fluid extraction (issue #223, ty adkinss).",
|
||||
|
@ -63,7 +64,7 @@
|
|||
"1.1.2-b1": "[U] Ported to MC1.16.2."
|
||||
},
|
||||
"promos": {
|
||||
"1.19.2-recommended": "1.3.28",
|
||||
"1.19.2-latest": "1.3.28"
|
||||
"1.19.3-recommended": "1.4.28",
|
||||
"1.19.3-latest": "1.4.28"
|
||||
}
|
||||
}
|
|
@ -11,6 +11,9 @@ Mod sources for Minecraft version 1.18.x.
|
|||
|
||||
## Version history
|
||||
|
||||
- v1.4.28 [U] Initial 1.19.3 port.
|
||||
[B] Known issue: Creative tab missing (currently using "Building Blocks").
|
||||
|
||||
- v1.3.28 [F] Steel Mesh Fence help typo fixed (issue #227, ty shrad).
|
||||
[A] Added "tree_cutter_universal_logs" server config to enable chopping of modded
|
||||
resource wood blocks (e.g. rubber, issue #228).
|
||||
|
|
|
@ -874,7 +874,7 @@ public class ModContent
|
|||
|
||||
public static void initItems()
|
||||
{
|
||||
Registries.addItem("metal_bar", ()->new EdItem((new Item.Properties()).tab(Registries.getCreativeModeTab())));
|
||||
Registries.addItem("metal_bar", ()->new EdItem((new Item.Properties())));
|
||||
}
|
||||
|
||||
public static void initEntities()
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
|
@ -40,6 +41,7 @@ public class ModEngineersDecor
|
|||
ModLoadingContext.get().registerConfig(net.minecraftforge.fml.config.ModConfig.Type.COMMON, ModConfig.COMMON_CONFIG_SPEC);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onSetup);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onClientSetup);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::addCreativeTab);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
@ -58,6 +60,12 @@ public class ModEngineersDecor
|
|||
ModContent.processContentClientSide(event);
|
||||
}
|
||||
|
||||
private void addCreativeTab(CreativeModeTabEvent.BuildContents event)
|
||||
{
|
||||
if(event.getTab() != Registries.getCreativeModeTab()) return;
|
||||
Registries.getRegisteredItems().forEach(event::accept);
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
|
||||
public static class ForgeEvents
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ package wile.engineersdecor.blocks;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
|
@ -118,8 +119,8 @@ public class EdChair
|
|||
public static EntityChair customClientFactory(PlayMessages.SpawnEntity spkt, Level world)
|
||||
{ return new EntityChair(world); }
|
||||
|
||||
public Packet<?> getAddEntityPacket()
|
||||
{ return NetworkHooks.getEntitySpawningPacket(this); }
|
||||
//public Packet<?> getAddEntityPacket()
|
||||
//{ return NetworkHooks.getEntitySpawningPacket(this); }
|
||||
|
||||
public static boolean accepts_mob(LivingEntity entity)
|
||||
{
|
||||
|
|
|
@ -141,7 +141,7 @@ public class EdMineralSmelter
|
|||
final ItemStack stack = player.getItemInHand(hand);
|
||||
boolean dirty = false;
|
||||
if(te.accepts_lava_container(stack)) {
|
||||
if(stack.sameItemStackIgnoreDurability(MineralSmelterTileEntity.BUCKET_STACK)) { // check how this works with item capabilities or so
|
||||
if(stack.sameItem(MineralSmelterTileEntity.BUCKET_STACK)) { // check how this works with item capabilities or so
|
||||
if(te.bucket_extraction_possible()) {
|
||||
if(stack.getCount() > 1) {
|
||||
int target_stack_index = -1;
|
||||
|
|
|
@ -9,34 +9,24 @@
|
|||
package wile.engineersdecor.items;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import wile.engineersdecor.ModConfig;
|
||||
import wile.engineersdecor.libmc.Auxiliaries;
|
||||
import wile.engineersdecor.libmc.Registries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class EdItem extends Item
|
||||
{
|
||||
public EdItem(Item.Properties properties)
|
||||
{ super(properties.tab(Registries.getCreativeModeTab())); }
|
||||
{ super(properties); }
|
||||
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void appendHoverText(ItemStack stack, @Nullable Level world, List<Component> tooltip, TooltipFlag flag)
|
||||
{ Auxiliaries.Tooltip.addInformation(stack, world, tooltip, flag, true); }
|
||||
|
||||
@Override
|
||||
public Collection<CreativeModeTab> getCreativeTabs()
|
||||
{ return ModConfig.isOptedOut(this) ? (new ArrayList<>()) : (Collections.singletonList(Registries.getCreativeModeTab())); }
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* JEI plugin (see https://github.com/mezz/JustEnoughItems/wiki/Creating-Plugins)
|
||||
*/
|
||||
package wile.engineersdecor.eapi.jei;
|
||||
package wile.engineersdecor.items.jei;
|
||||
|
||||
public class JEIPlugin {}
|
||||
/*
|
|
@ -11,13 +11,14 @@ package wile.engineersdecor.libmc;
|
|||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.ComponentUtils;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -43,10 +44,7 @@ import java.io.BufferedReader;
|
|||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -91,19 +89,30 @@ public class Auxiliaries
|
|||
{ return SharedConstants.IS_RUNNING_IN_IDE; }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@SuppressWarnings("all")
|
||||
public static boolean isShiftDown()
|
||||
{
|
||||
return (InputConstants.isKeyDown(SidedProxy.mc().getWindow().getWindow(), GLFW.GLFW_KEY_LEFT_SHIFT) ||
|
||||
InputConstants.isKeyDown(SidedProxy.mc().getWindow().getWindow(), GLFW.GLFW_KEY_RIGHT_SHIFT));
|
||||
return (InputConstants.isKeyDown(net.minecraft.client.Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_KEY_LEFT_SHIFT) ||
|
||||
InputConstants.isKeyDown(net.minecraft.client.Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_KEY_RIGHT_SHIFT));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@SuppressWarnings("all")
|
||||
public static boolean isCtrlDown()
|
||||
{
|
||||
return (InputConstants.isKeyDown(SidedProxy.mc().getWindow().getWindow(), GLFW.GLFW_KEY_LEFT_CONTROL) ||
|
||||
InputConstants.isKeyDown(SidedProxy.mc().getWindow().getWindow(), GLFW.GLFW_KEY_RIGHT_CONTROL));
|
||||
return (InputConstants.isKeyDown(net.minecraft.client.Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_KEY_LEFT_CONTROL) ||
|
||||
InputConstants.isKeyDown(net.minecraft.client.Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_KEY_RIGHT_CONTROL));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static Optional<String> getClipboard()
|
||||
{ return Optional.of(net.minecraft.client.gui.font.TextFieldHelper.getClipboardContents(net.minecraft.client.Minecraft.getInstance())); }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static boolean setClipboard(String text)
|
||||
{ net.minecraft.client.gui.font.TextFieldHelper.setClipboardContents(net.minecraft.client.Minecraft.getInstance(), text); return true; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------
|
||||
// Logging
|
||||
// -------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -117,9 +126,6 @@ public class Auxiliaries
|
|||
public static void logError(final String msg)
|
||||
{ logger.error(msg); }
|
||||
|
||||
public static void logDebug(final String msg)
|
||||
{ /*logger.debug(msg);*/ }
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------
|
||||
// Localization, text formatting
|
||||
// -------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -187,6 +193,10 @@ public class Auxiliaries
|
|||
public static boolean hasTranslation(String key)
|
||||
{ return net.minecraft.client.resources.language.I18n.exists(key); }
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static List<Component> wrapText(Component text, int max_width_percent)
|
||||
{ return Minecraft.getInstance().font.getSplitter().splitLines(text, ((Minecraft.getInstance().getWindow().getGuiScaledWidth())-10) * max_width_percent/100, Style.EMPTY).stream().map(ft->Component.literal(ft.getString())).collect(Collectors.toList()); }
|
||||
|
||||
public static MutableComponent join(Collection<? extends Component> components, String separator)
|
||||
{ return ComponentUtils.formatList(components, Component.literal(separator), Function.identity()); }
|
||||
|
||||
|
@ -278,19 +288,18 @@ public class Auxiliaries
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static ResourceLocation getResourceLocation(Item item)
|
||||
{ return Registry.ITEM.getKey(item); }
|
||||
{ return ForgeRegistries.ITEMS.getKey(item); }
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static ResourceLocation getResourceLocation(Block block)
|
||||
{ return Registry.BLOCK.getKey(block); }
|
||||
|
||||
{ return ForgeRegistries.BLOCKS.getKey(block); }
|
||||
@SuppressWarnings("deprecation")
|
||||
public static ResourceLocation getResourceLocation(net.minecraft.world.inventory.MenuType<?> menu)
|
||||
{ return Registry.MENU.getKey(menu); }
|
||||
{ return ForgeRegistries.MENU_TYPES.getKey(menu); }
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static ResourceLocation getResourceLocation(net.minecraft.world.level.material.Fluid fluid)
|
||||
{ return Registry.FLUID.getKey(fluid); }
|
||||
{ return ForgeRegistries.FLUIDS.getKey(fluid); }
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------
|
||||
// Item NBT data
|
||||
|
|
|
@ -159,16 +159,16 @@ public class Guis
|
|||
public UiWidget init(Screen parent)
|
||||
{
|
||||
this.parent_ = parent;
|
||||
this.x += ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiLeft() : 0);
|
||||
this.y += ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiTop() : 0);
|
||||
this.setX(getX() + ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiLeft() : 0));
|
||||
this.setY(getY() + ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiTop() : 0));
|
||||
return this;
|
||||
}
|
||||
|
||||
public UiWidget init(Screen parent, Coord2d position)
|
||||
{
|
||||
this.parent_ = parent;
|
||||
this.x = position.x + ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiLeft() : 0);
|
||||
this.y = position.y + ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiTop() : 0);
|
||||
this.setX(position.x + ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiLeft() : 0));
|
||||
this.setY(position.y + ((parent instanceof AbstractContainerScreen<?>) ? ((AbstractContainerScreen<?>)parent).getGuiTop() : 0));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -188,13 +188,13 @@ public class Guis
|
|||
{
|
||||
final Window win = mc_.getWindow();
|
||||
return Coord2d.of(
|
||||
Mth.clamp(((int)(mc_.mouseHandler.xpos() * (double)win.getGuiScaledWidth() / (double)win.getScreenWidth()))-this.x, -1, this.width+1),
|
||||
Mth.clamp(((int)(mc_.mouseHandler.ypos() * (double)win.getGuiScaledHeight() / (double)win.getScreenHeight()))-this.y, -1, this.height+1)
|
||||
Mth.clamp(((int)(mc_.mouseHandler.xpos() * (double)win.getGuiScaledWidth() / (double)win.getScreenWidth()))-getX(), -1, this.width+1),
|
||||
Mth.clamp(((int)(mc_.mouseHandler.ypos() * (double)win.getGuiScaledHeight() / (double)win.getScreenHeight()))-getY(), -1, this.height+1)
|
||||
);
|
||||
}
|
||||
|
||||
protected final Coord2d screenCoordinates(Coord2d xy, boolean reverse)
|
||||
{ return (reverse) ? (Coord2d.of(xy.x+x, xy.y+y)) : (Coord2d.of(xy.x-x, xy.y-y)); }
|
||||
{ return (reverse) ? (Coord2d.of(xy.x+getX(), xy.y+getY())) : (Coord2d.of(xy.x-getX(), xy.y-getY())); }
|
||||
|
||||
public UiWidget show()
|
||||
{ visible = true; return this; }
|
||||
|
@ -202,6 +202,13 @@ public class Guis
|
|||
public UiWidget hide()
|
||||
{ visible = false; return this; }
|
||||
|
||||
public void render(PoseStack mx, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(!visible) return;
|
||||
isHovered = (mouseX >= getX()) && (mouseY >= getY()) && (mouseX < getX()+width) && (mouseY < getY()+height);
|
||||
renderButton(mx, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack mxs, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
|
@ -209,7 +216,6 @@ public class Guis
|
|||
if(isHovered) renderToolTip(mxs, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("all")
|
||||
public void renderToolTip(PoseStack mx, int mouseX, int mouseY)
|
||||
{
|
||||
|
@ -220,7 +226,7 @@ public class Guis
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateNarration(NarrationElementOutput element_output)
|
||||
public void updateWidgetNarration(NarrationElementOutput element_output)
|
||||
{}
|
||||
}
|
||||
|
||||
|
@ -275,10 +281,10 @@ public class Guis
|
|||
RenderSystem.enableBlend();
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
blit(mxs, x, y, texture_position_base_.x, texture_position_base_.y, width, height);
|
||||
blit(mxs, getX(), getY(), texture_position_base_.x, texture_position_base_.y, width, height);
|
||||
if((progress_max_ > 0) && (progress_ > 0)) {
|
||||
int w = Mth.clamp((int)Math.round((progress_ * width) / progress_max_), 0, width);
|
||||
blit(mxs, x, y, texture_position_filled_.x, texture_position_filled_.y, w, height);
|
||||
blit(mxs, getX(), getY(), texture_position_filled_.x, texture_position_filled_.y, w, height);
|
||||
}
|
||||
if(isHovered) renderToolTip(mxs, mouseX, mouseY);
|
||||
}
|
||||
|
@ -305,7 +311,7 @@ public class Guis
|
|||
{
|
||||
if(!visible) return;
|
||||
RenderSystem.setShaderTexture(0, atlas_);
|
||||
parent.blit(mx, x, y, atlas_position_.x, atlas_position_.y, width, height);
|
||||
parent.blit(mx, getX(), getY(), atlas_position_.x, atlas_position_.y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,7 +355,7 @@ public class Guis
|
|||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
Coord2d pos = checked_ ? texture_position_on_ : texture_position_off_;
|
||||
blit(mxs, x, y, pos.x, pos.y, width, height);
|
||||
blit(mxs, getX(), getY(), pos.x, pos.y, width, height);
|
||||
if(isHovered) renderToolTip(mxs, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +392,7 @@ public class Guis
|
|||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
Coord2d pos = texture_position_;
|
||||
blit(mxs, x, y, pos.x, pos.y, width, height);
|
||||
blit(mxs, getX(), getY(), pos.x, pos.y, width, height);
|
||||
if(isHovered) renderToolTip(mxs, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
@ -418,7 +424,7 @@ public class Guis
|
|||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.enableDepthTest();
|
||||
Coord2d pos = texture_position_;
|
||||
blit(mxs, x, y, pos.x, pos.y, width, height);
|
||||
blit(mxs, getX(), getY(), pos.x, pos.y, width, height);
|
||||
if(isHovered) renderToolTip(mxs, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ public class Inventories
|
|||
public static boolean areItemStacksDifferent(ItemStack a, ItemStack b)
|
||||
{ return (a.getItem()!=b.getItem()) || (!ItemStack.tagMatches(a, b)); }
|
||||
|
||||
public static boolean isItemStackableOn(ItemStack a, ItemStack b)
|
||||
{ return (!a.isEmpty()) && (a.sameItem(b)) && (a.hasTag() == b.hasTag()) && (!a.hasTag() || a.getTag().equals(b.getTag())) && a.areCapsCompatible(b); }
|
||||
|
||||
public static IItemHandler itemhandler(Level world, BlockPos pos, @Nullable Direction side)
|
||||
{
|
||||
BlockEntity te = world.getBlockEntity(pos);
|
||||
|
@ -226,7 +229,7 @@ public class Inventories
|
|||
final int slot_limit = inv_.getMaxStackSize();
|
||||
if(!sst.isEmpty()) {
|
||||
if(sst.getCount() >= Math.min(sst.getMaxStackSize(), slot_limit)) return stack;
|
||||
if(!ItemHandlerHelper.canItemStacksStack(stack, sst)) return stack;
|
||||
if(!isItemStackableOn(stack, sst)) return stack;
|
||||
final int limit = Math.min(stack.getMaxStackSize(), slot_limit) - sst.getCount();
|
||||
if(stack.getCount() <= limit) {
|
||||
if(!simulate) {
|
||||
|
|
|
@ -12,10 +12,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
@ -29,7 +26,6 @@ import java.util.*;
|
|||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Registries
|
||||
{
|
||||
|
@ -70,11 +66,13 @@ public class Registries
|
|||
|
||||
public static CreativeModeTab getCreativeModeTab()
|
||||
{
|
||||
if(creative_tab==null) {
|
||||
creative_tab = (new CreativeModeTab("tab" + modid) {
|
||||
public ItemStack makeIcon() { return new ItemStack(getItem(creative_tab_icon)); }
|
||||
});
|
||||
}
|
||||
creative_tab = CreativeModeTabs.BUILDING_BLOCKS;
|
||||
// if(creative_tab==null) {
|
||||
// creative_tab = (new CreativeModeTab("tab" + modid) {
|
||||
// public ItemStack makeIcon() { return new ItemStack(getItem(creative_tab_icon)); }
|
||||
// });
|
||||
// }
|
||||
// return creative_tab;
|
||||
return creative_tab;
|
||||
}
|
||||
|
||||
|
@ -120,19 +118,19 @@ public class Registries
|
|||
|
||||
@Nonnull
|
||||
public static List<Block> getRegisteredBlocks()
|
||||
{ return Collections.unmodifiableList(registered_blocks.values().stream().map(RegistryObject::get).toList()); }
|
||||
{ return registered_blocks.values().stream().map(RegistryObject::get).toList(); }
|
||||
|
||||
@Nonnull
|
||||
public static List<Item> getRegisteredItems()
|
||||
{ return Collections.unmodifiableList(registered_items.values().stream().map(RegistryObject::get).toList()); }
|
||||
{ return registered_items.values().stream().map(RegistryObject::get).toList(); }
|
||||
|
||||
@Nonnull
|
||||
public static List<BlockEntityType<?>> getRegisteredBlockEntityTypes()
|
||||
{ return Collections.unmodifiableList(registered_block_entity_types.values().stream().map(RegistryObject::get).toList()); }
|
||||
public static List<? extends BlockEntityType<?>> getRegisteredBlockEntityTypes()
|
||||
{ return registered_block_entity_types.values().stream().map(RegistryObject::get).toList(); }
|
||||
|
||||
@Nonnull
|
||||
public static List<EntityType<?>> getRegisteredEntityTypes()
|
||||
{ return Collections.unmodifiableList(registered_entity_types.values().stream().map(RegistryObject::get).toList()); }
|
||||
public static List<? extends EntityType<?>> getRegisteredEntityTypes()
|
||||
{ return registered_entity_types.values().stream().map(RegistryObject::get).toList(); }
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -142,7 +140,7 @@ public class Registries
|
|||
public static <T extends Block> void addBlock(String registry_name, Supplier<T> block_supplier)
|
||||
{
|
||||
registered_blocks.put(registry_name, BLOCKS.register(registry_name, block_supplier));
|
||||
registered_items.put(registry_name, ITEMS.register(registry_name, ()->new BlockItem(registered_blocks.get(registry_name).get(), (new Item.Properties()).tab(getCreativeModeTab()))));
|
||||
registered_items.put(registry_name, ITEMS.register(registry_name, ()->new BlockItem(registered_blocks.get(registry_name).get(), new Item.Properties())));
|
||||
}
|
||||
|
||||
public static <TB extends Block, TI extends Item> void addBlock(String registry_name, Supplier<TB> block_supplier, Supplier<TI> item_supplier)
|
||||
|
@ -156,9 +154,9 @@ public class Registries
|
|||
registered_block_entity_types.put(registry_name, BLOCK_ENTITIES.register(registry_name, ()->{
|
||||
final Block[] blocks = Arrays.stream(block_names).map(s->{
|
||||
Block b = BLOCKS.getEntries().stream().filter((ro)->ro.getId().getPath().equals(s)).findFirst().map(RegistryObject::get).orElse(null);
|
||||
if(b==null) Auxiliaries.logError("registered_blocks does not encompass '" + s + "'");
|
||||
if(b == null) Auxiliaries.logError("registered_blocks does not encompass '" + s + "'");
|
||||
return b;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList()).toArray(new Block[]{});
|
||||
}).filter(Objects::nonNull).toList().toArray(new Block[]{});
|
||||
return BlockEntityType.Builder.of(ctor, blocks).build(null);
|
||||
}));
|
||||
}
|
||||
|
@ -191,9 +189,7 @@ public class Registries
|
|||
// -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
public static <TB extends Block, TI extends Item> void addBlock(String registry_name, Supplier<TB> block_supplier, BiFunction<Block, Item.Properties, Item> item_builder)
|
||||
{
|
||||
addBlock(registry_name, block_supplier, ()->item_builder.apply(registered_blocks.get(registry_name).get(), (new Item.Properties()).tab(getCreativeModeTab())));
|
||||
}
|
||||
{ addBlock(registry_name, block_supplier, ()->item_builder.apply(registered_blocks.get(registry_name).get(), new Item.Properties())); }
|
||||
|
||||
public static void addBlock(String registry_name, Supplier<? extends Block> block_supplier, BlockEntityType.BlockEntitySupplier<?> block_entity_ctor)
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ public class StandardDoorBlock extends DoorBlock implements StandardBlocks.IStan
|
|||
|
||||
public StandardDoorBlock(long config, BlockBehaviour.Properties properties, AABB[] open_aabbs_top, AABB[] open_aabbs_bottom, AABB[] closed_aabbs_top, AABB[] closed_aabbs_bottom, SoundEvent open_sound, SoundEvent close_sound)
|
||||
{
|
||||
super(properties);
|
||||
super(properties, open_sound, close_sound);
|
||||
VoxelShape[][][][] shapes = new VoxelShape[Direction.values().length][2][2][2];
|
||||
for(Direction facing: Direction.values()) {
|
||||
for(boolean open: new boolean[]{false,true}) {
|
||||
|
|
|
@ -12,20 +12,20 @@ displayName="Engineer's Decor"
|
|||
description="Adds cosmetic blocks for the engineer's workshop, factory and home."
|
||||
authors="wilechaote"
|
||||
credits="BluSunrize, Damien Hazard, malte0811, et al., the Forge Smiths."
|
||||
updateJSONURL="https://raw.githubusercontent.com/stfwi/engineers-decor/versions/forge-1.19.2.json"
|
||||
updateJSONURL="https://raw.githubusercontent.com/stfwi/engineers-decor/versions/forge-1.19.3.json"
|
||||
displayURL="https://www.curseforge.com/minecraft/mc-mods/engineers-decor"
|
||||
logoFile="logo.png"
|
||||
|
||||
[[dependencies.engineersdecor]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[43.0.16,)"
|
||||
versionRange="[44.0.11,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.engineersdecor]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.19.2]"
|
||||
versionRange="[1.19.3]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"pack": {
|
||||
"description": "engineersdecor resources",
|
||||
"pack_format": 9,
|
||||
"forge:resource_pack_format": 9,
|
||||
"description": "redstonepen resources",
|
||||
"pack_format": 12,
|
||||
"forge:resource_pack_format": 12,
|
||||
"forge:data_pack_format": 10
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue