From b18463aa1ec0d1c6ba6defc28db542ea011b6740 Mon Sep 17 00:00:00 2001 From: Mysaa Date: Mon, 24 May 2021 01:33:27 +0200 Subject: [PATCH] =?UTF-8?q?Premier=20commit=20-=20Initialisation=20au=20sy?= =?UTF-8?q?st=C3=A8me=20git?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 9 +++ build.gradle | 70 ++++++++++++++++++ .../luckyWaking/LuckyWakingMod.java | 41 ++++++++++ .../samsoule63/luckyWaking/References.java | 10 +++ .../luckyWaking/blocks/StarBlock.java | 15 ++++ .../luckyWaking/event/OnPlayerSleep.java | 11 +++ .../luckyWaking/event/OnPlayerWakeUp.java | 29 ++++++++ .../luckyWaking/init/LuckyWakingBlocks.java | 38 ++++++++++ .../luckyWaking/init/LuckyWakingItems.java | 34 +++++++++ .../luckyWaking/proxy/ProxyClient.java | 15 ++++ .../luckyWaking/proxy/ProxyCommon.java | 11 +++ .../entity/player/PlayerSleepInBedEvent.java | 35 +++++++++ .../entity/player/PlayerWakeUpEvent.java | 40 ++++++++++ .../assets/luckyW/blockstates/starBlock.json | 7 ++ .../resources/assets/luckyW/lang/fr_FR.lang | 3 + .../assets/luckyW/models/block/starBlock.json | 6 ++ .../assets/luckyW/models/item/itemBasic.json | 18 +++++ .../assets/luckyW/models/item/starBlock.json | 10 +++ .../luckyW/textures/blocks/starBlock.png | Bin 0 -> 524 bytes .../luckyW/textures/items/itemBasic.png | Bin 0 -> 1207 bytes src/main/resources/mcmod.info | 16 ++++ 21 files changed, 418 insertions(+) create mode 100644 .gitignore create mode 100644 build.gradle create mode 100644 src/main/java/com/samsoule63/luckyWaking/LuckyWakingMod.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/References.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/blocks/StarBlock.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/event/OnPlayerSleep.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/event/OnPlayerWakeUp.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingBlocks.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingItems.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/proxy/ProxyClient.java create mode 100644 src/main/java/com/samsoule63/luckyWaking/proxy/ProxyCommon.java create mode 100644 src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java create mode 100644 src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java create mode 100644 src/main/resources/assets/luckyW/blockstates/starBlock.json create mode 100644 src/main/resources/assets/luckyW/lang/fr_FR.lang create mode 100644 src/main/resources/assets/luckyW/models/block/starBlock.json create mode 100644 src/main/resources/assets/luckyW/models/item/itemBasic.json create mode 100644 src/main/resources/assets/luckyW/models/item/starBlock.json create mode 100644 src/main/resources/assets/luckyW/textures/blocks/starBlock.png create mode 100644 src/main/resources/assets/luckyW/textures/items/itemBasic.png create mode 100644 src/main/resources/mcmod.info diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9cf89b --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.classpath +.gradle/ +.project +.settings/ +bin/ +eclipse/ +gradle/ +gradlew +gradlew.bat diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..af30b15 --- /dev/null +++ b/build.gradle @@ -0,0 +1,70 @@ +buildscript { + repositories { + mavenCentral() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + } +} + +apply plugin: 'forge' + +version = "1.0" +group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html +archivesBaseName = "modid" + +minecraft { + version = "1.8-11.14.3.1450" + runDir = "eclipse" + + // the mappings can be changed at any time, and must be in the following format. + // snapshot_YYYYMMDD snapshot are built nightly. + // stable_# stables are built at the discretion of the MCP team. + // Use non-default mappings at your own risk. they may not allways work. + // simply re-run your setup task after changing the mappings to update your workspace. + mappings = "snapshot_20141130" +} + +dependencies { + // you may put jars on which you depend on in ./libs + // or you may define them like so.. + //compile "some.group:artifact:version:classifier" + //compile "some.group:artifact:version" + + // real examples + //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env + //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env + + // for more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html + +} + +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} diff --git a/src/main/java/com/samsoule63/luckyWaking/LuckyWakingMod.java b/src/main/java/com/samsoule63/luckyWaking/LuckyWakingMod.java new file mode 100644 index 0000000..7118959 --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/LuckyWakingMod.java @@ -0,0 +1,41 @@ +package com.samsoule63.luckyWaking; + +import com.samsoule63.luckyWaking.init.LuckyWakingBlocks; +import com.samsoule63.luckyWaking.init.LuckyWakingItems; +import com.samsoule63.luckyWaking.proxy.ProxyCommon; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +@Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION) +public class LuckyWakingMod +{ + @SidedProxy(clientSide = References.CLIENT_PROXY, serverSide = References.COMMON_PROXY) + public static ProxyCommon proxy; + + @EventHandler + public void preInit(FMLPreInitializationEvent event) + { + LuckyWakingItems.init(); + LuckyWakingItems.register(); + LuckyWakingBlocks.init(); + LuckyWakingBlocks.register(); + } + + @EventHandler + public void init(FMLInitializationEvent event) + { + proxy.registerRenders(); + } + + @EventHandler + public void postInit(FMLPostInitializationEvent event) + { + + } + +} diff --git a/src/main/java/com/samsoule63/luckyWaking/References.java b/src/main/java/com/samsoule63/luckyWaking/References.java new file mode 100644 index 0000000..799013d --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/References.java @@ -0,0 +1,10 @@ +package com.samsoule63.luckyWaking; + +public class References +{ + public static final String MODID = "luckyW"; + public static final String MODNAME = "Lucky Waking"; + public static final String VERSION = "1.0"; + public static final String CLIENT_PROXY = "com.samsoule63.luckyWaking.proxy.ProxyClient"; + public static final String COMMON_PROXY = "com.samsoule63.luckyWaking.proxy.ProxyCommon"; +} diff --git a/src/main/java/com/samsoule63/luckyWaking/blocks/StarBlock.java b/src/main/java/com/samsoule63/luckyWaking/blocks/StarBlock.java new file mode 100644 index 0000000..0062965 --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/blocks/StarBlock.java @@ -0,0 +1,15 @@ +package com.samsoule63.luckyWaking.blocks; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; + +public class StarBlock extends Block +{ + + public StarBlock(Material materialIn) + { + super(materialIn); + // TODO Auto-generated constructor stub + } + +} diff --git a/src/main/java/com/samsoule63/luckyWaking/event/OnPlayerSleep.java b/src/main/java/com/samsoule63/luckyWaking/event/OnPlayerSleep.java new file mode 100644 index 0000000..4638fd7 --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/event/OnPlayerSleep.java @@ -0,0 +1,11 @@ +package com.samsoule63.luckyWaking.event; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.BlockPos; + +public class OnPlayerSleep +{ + public static void onPlayerSleep(EntityPlayer player, BlockPos pos){ + System.out.println("!!!!****µµµµ$$$$££££"+player.toString()+"sleep in "+pos.toString()); + } +} diff --git a/src/main/java/com/samsoule63/luckyWaking/event/OnPlayerWakeUp.java b/src/main/java/com/samsoule63/luckyWaking/event/OnPlayerWakeUp.java new file mode 100644 index 0000000..178ed8a --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/event/OnPlayerWakeUp.java @@ -0,0 +1,29 @@ +package com.samsoule63.luckyWaking.event; + +import tv.twitch.chat.ChatMessageToken; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; + +public class OnPlayerWakeUp +{ + public static void playerWakeUp(EntityPlayer player, boolean wakeImmediatly, boolean updateWorld, boolean setSpawn) + { + int z = (int)(Math.random() * 2); + switch(z) + { + case 0: + player.addChatComponentMessage(new ChatComponentText("Ca te dit une barre de vie en plus ?"));; + player.setAbsorptionAmount(player.getAbsorptionAmount() + 20); + break; + case 1: + player.addChatComponentMessage(new ChatComponentText("Ca te dit 100 niveaux en plus ?"));; + player.addExperienceLevel(100); + break; + default: + player.addChatComponentMessage(new ChatComponentText("Rien aujourdhui ..."));; + + break; + } + } +} diff --git a/src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingBlocks.java b/src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingBlocks.java new file mode 100644 index 0000000..b085478 --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingBlocks.java @@ -0,0 +1,38 @@ +package com.samsoule63.luckyWaking.init; + +import com.samsoule63.luckyWaking.References; +import com.samsoule63.luckyWaking.blocks.StarBlock; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraftforge.fml.common.registry.GameRegistry; + +public class LuckyWakingBlocks +{ + public static Block starBlock; + + public static void init() + { + starBlock = new StarBlock(Material.ground).setUnlocalizedName("starBlock").setCreativeTab(CreativeTabs.tabBlock); + } + + public static void register() + { + GameRegistry.registerBlock(starBlock,starBlock.getUnlocalizedName().substring(5)); + } + + public static void registerRenders() + { + registerRender(starBlock); + } + + public static void registerRender(Block block) + { + Item item = Item.getItemFromBlock(block); + Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(References.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); + } +} diff --git a/src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingItems.java b/src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingItems.java new file mode 100644 index 0000000..ba82295 --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/init/LuckyWakingItems.java @@ -0,0 +1,34 @@ +package com.samsoule63.luckyWaking.init; + +import com.samsoule63.luckyWaking.References; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraftforge.fml.common.registry.GameRegistry; + +public class LuckyWakingItems +{ + public static Item itemBasic; + + public static void init() + { + itemBasic = new Item().setUnlocalizedName("itemBasic").setCreativeTab(CreativeTabs.tabMisc); + } + + public static void register() + { + GameRegistry.registerItem(itemBasic, "itemBasic"); + } + + public static void registerRenders() + { + registerRender(itemBasic); + } + + public static void registerRender(Item item) + { + Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(References.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); + } +} diff --git a/src/main/java/com/samsoule63/luckyWaking/proxy/ProxyClient.java b/src/main/java/com/samsoule63/luckyWaking/proxy/ProxyClient.java new file mode 100644 index 0000000..e1ee05d --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/proxy/ProxyClient.java @@ -0,0 +1,15 @@ +package com.samsoule63.luckyWaking.proxy; + +import com.samsoule63.luckyWaking.init.LuckyWakingBlocks; +import com.samsoule63.luckyWaking.init.LuckyWakingItems; + +public class ProxyClient extends ProxyCommon +{ + @Override + public void registerRenders() + { + LuckyWakingItems.registerRenders(); + LuckyWakingBlocks.registerRenders(); + } + +} diff --git a/src/main/java/com/samsoule63/luckyWaking/proxy/ProxyCommon.java b/src/main/java/com/samsoule63/luckyWaking/proxy/ProxyCommon.java new file mode 100644 index 0000000..08c9f07 --- /dev/null +++ b/src/main/java/com/samsoule63/luckyWaking/proxy/ProxyCommon.java @@ -0,0 +1,11 @@ +package com.samsoule63.luckyWaking.proxy; + +public class ProxyCommon +{ + + public void registerRenders() + { + + } + +} diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java new file mode 100644 index 0000000..0bc3da2 --- /dev/null +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerSleepInBedEvent.java @@ -0,0 +1,35 @@ +package net.minecraftforge.event.entity.player; + +import com.samsoule63.luckyWaking.event.OnPlayerSleep; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayer.EnumStatus; +import net.minecraft.util.BlockPos; +import net.minecraft.entity.player.EntityPlayer.EnumStatus; +/** + * PlayerSleepInBedEvent is fired when a player sleeps in a bed. + *
+ * This event is fired whenever a player sleeps in a bed in + * EntityPlayer#sleepInBedAt(BlockPos).
+ *
+ * {@link #result} contains whether the player is able to sleep.
+ *
+ * This event is not {@link Cancelable}. + *
+ * This event does not have a result. {@link HasResult} + *
+ * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + **/ +public class PlayerSleepInBedEvent extends PlayerEvent +{ + public EnumStatus result = null; + public final BlockPos pos; + + public PlayerSleepInBedEvent(EntityPlayer player, BlockPos pos) + { + super(player); + OnPlayerSleep.onPlayerSleep(player, pos); + this.pos = pos; + } + +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java new file mode 100644 index 0000000..aa1c5a0 --- /dev/null +++ b/src/main/java/net/minecraftforge/event/entity/player/PlayerWakeUpEvent.java @@ -0,0 +1,40 @@ +package net.minecraftforge.event.entity.player; + +import com.samsoule63.luckyWaking.event.OnPlayerWakeUp; + +import net.minecraft.entity.player.EntityPlayer; + +/** + * This event is fired when the player is waking up.
+ * This is merely for purposes of listening for this to happen.
+ * There is nothing that can be manipulated with this event. + */ +public class PlayerWakeUpEvent extends PlayerEvent +{ + /** + * Used for the 'wake up animation'. + * This is false if the player is considered 'sleepy' and the overlay should slowly fade away. + */ + public final boolean wakeImmediatly; + + /** + * Indicates if the server should be notified of sleeping changes. + * This will only be false if the server is considered 'up to date' already, because, for example, it initiated the call. + */ + public final boolean updateWorld; + + /** + * Indicates if the player's sleep was considered successful. + * In vanilla, this is used to determine if the spawn chunk is to be set to the bed's position. + */ + public final boolean setSpawn; + + public PlayerWakeUpEvent(EntityPlayer player, boolean wakeImmediatly, boolean updateWorld, boolean setSpawn) + { + super(player); + this.wakeImmediatly = wakeImmediatly; + this.updateWorld = updateWorld; + this.setSpawn = setSpawn; + OnPlayerWakeUp.playerWakeUp(player, wakeImmediatly, updateWorld, setSpawn); + } +} \ No newline at end of file diff --git a/src/main/resources/assets/luckyW/blockstates/starBlock.json b/src/main/resources/assets/luckyW/blockstates/starBlock.json new file mode 100644 index 0000000..4059b03 --- /dev/null +++ b/src/main/resources/assets/luckyW/blockstates/starBlock.json @@ -0,0 +1,7 @@ +{ + "variants": { + "normal": [ + { "model": "luckyW:starBlock" }, + ] + } +} diff --git a/src/main/resources/assets/luckyW/lang/fr_FR.lang b/src/main/resources/assets/luckyW/lang/fr_FR.lang new file mode 100644 index 0000000..2cc35ec --- /dev/null +++ b/src/main/resources/assets/luckyW/lang/fr_FR.lang @@ -0,0 +1,3 @@ +item.itemBasic.name=Item Basique + +tile.starBlock.name=Bloc étoile \ No newline at end of file diff --git a/src/main/resources/assets/luckyW/models/block/starBlock.json b/src/main/resources/assets/luckyW/models/block/starBlock.json new file mode 100644 index 0000000..eddebba --- /dev/null +++ b/src/main/resources/assets/luckyW/models/block/starBlock.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "luckyw:item/starBlock" + } +} diff --git a/src/main/resources/assets/luckyW/models/item/itemBasic.json b/src/main/resources/assets/luckyW/models/item/itemBasic.json new file mode 100644 index 0000000..3230f3b --- /dev/null +++ b/src/main/resources/assets/luckyW/models/item/itemBasic.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "luckyW:items/itemBasic" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/luckyW/models/item/starBlock.json b/src/main/resources/assets/luckyW/models/item/starBlock.json new file mode 100644 index 0000000..4995087 --- /dev/null +++ b/src/main/resources/assets/luckyW/models/item/starBlock.json @@ -0,0 +1,10 @@ +{ + "parent": "luckyW:block/starBlock", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/luckyW/textures/blocks/starBlock.png b/src/main/resources/assets/luckyW/textures/blocks/starBlock.png new file mode 100644 index 0000000000000000000000000000000000000000..bead77e24f0d7fa4ce666f776ec18376732eda27 GIT binary patch literal 524 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4kiW$h6xih%orFLI14-?iy0WWg+Z8+Vb&Z8 z1_lQ95>H=O_WN97ypr4^CEu$V7#L(TLn2C?^K)}k^GX;%z_})F% z4~czE`4=X?Pw<~-(;1}YB61_f1dCf8YO8JB9r_MdqD)tEto z@A>Xnl|H6<;wo?dw_K3=m(r<`czmN2-}7IL3}-gU$*S`+%o8s-C-h+d1E+%Py1Vlt zIpmIOo!+LiQ2MXN@zp1vB-?!J*V?9YF)#l2zpRZn1Q;0-wpNL=>|VcKV{fgVdgy`9i{C|Kf{*Tg9ju3a4h zJ2U0}ct+>lcH3Uv&oJFZLDfuZ>(ipmaqV8Rd8>5y@3frnXFpYGX@*(!r#Fj&lCDYC zzPtEh?#yS-hq{$iS@KP?nh&mi&gwGdZ|nZ}$1fr;Pm^Y2I`F<_i^|?wt4xU-S+Pt9 Y%)cq0^PMjdR|ASBPgg&ebxsLQ0Nwc94*&oF literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/luckyW/textures/items/itemBasic.png b/src/main/resources/assets/luckyW/textures/items/itemBasic.png new file mode 100644 index 0000000000000000000000000000000000000000..7f5189fa2f1ca0929c3b7412bf20fe6fac6a9e11 GIT binary patch literal 1207 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s7*pj^6T^Rl|a5HePSl~5_ zfq{Xuz$3Dlfq`2Xgc%uT&5>YWU|=ut^mS#w&&kOzD#|w@Cz*kPK{hiaqQp5rH#aq} zgaHJci&7IyQd1PlGfOfQ+&z5*QuI>U85mfkJzX3_ECd+^Sl<6;{Qv(yNG$`y&YkiM z!NJddfBk9<68OWwzzCv|F$)93|3BZpJ>%r$1ZjE+&?CL7S*wtmoWMCk|z`(G9fq`Km3)p6PdH?^sygH0pTG9+^ zYJZq--2&+YDFTHMi2ae7fkB+n%}tU~M#k{}uV1{3Y@lFc*vG;kB=qQ-Z{{P{_KN!u-eluukeg604$(x_*>WnPE z&CFz&qoXe}2nw?Pzi@$%>Cq!eP#iHZFz_)jFfc<6_{+q=!1jOBrceJE7#=g)*nIlC zd-nyF-Mgh2e=#svFf%Z?GB7acFfuTxGB7X*Gcqu6GcYhPfkFyo04Oy7Gcf#PU|{&l zz`*eK9|Obf{|pRQe={)bW?^DrkY`|EkYI$Q2o44Y1`uXqz>Ecu7)TC;1sE9^#Mu}a z